📄 ch16_11.htm
字号:
<HTML><!--Distributed by F --><HEAD><TITLE>[Chapter 16] 16.11 Showing Hidden Files with ls -A and -a </TITLE><METANAME="DC.title"CONTENT="UNIX Power Tools"><METANAME="DC.creator"CONTENT="Jerry Peek, Tim O'Reilly & Mike Loukides"><METANAME="DC.publisher"CONTENT="O'Reilly & Associates, Inc."><METANAME="DC.date"CONTENT="1998-08-04T21:37:45Z"><METANAME="DC.type"CONTENT="Text.Monograph"><METANAME="DC.format"CONTENT="text/html"SCHEME="MIME"><METANAME="DC.source"CONTENT="1-56592-260-3"SCHEME="ISBN"><METANAME="DC.language"CONTENT="en-US"><METANAME="generator"CONTENT="Jade 1.1/O'Reilly DocBook 3.0 to HTML 4.0"><LINKREV="made"HREF="mailto:online-books@oreilly.com"TITLE="Online Books Comments"><LINKREL="up"HREF="ch16_01.htm"TITLE="16. Where Did I Put That?"><LINKREL="prev"HREF="ch16_10.htm"TITLE="16.10 findcmd: Find a Command in Your Search Path "><LINKREL="next"HREF="ch16_12.htm"TITLE="16.12 Useful ls Aliases "></HEAD><BODYBGCOLOR="#FFFFFF"TEXT="#000000"><DIVCLASS="htmlnav"><H1><IMGSRC="gifs/smbanner.gif"ALT="UNIX Power Tools"USEMAP="#srchmap"BORDER="0"></H1><MAPNAME="srchmap"><AREASHAPE="RECT"COORDS="0,0,466,58"HREF="index.htm"ALT="UNIX Power Tools"><AREASHAPE="RECT"COORDS="467,0,514,18"HREF="jobjects/fsearch.htm"ALT="Search this book"></MAP><TABLEWIDTH="515"BORDER="0"CELLSPACING="0"CELLPADDING="0"><TR><TDALIGN="LEFT"VALIGN="TOP"WIDTH="172"><ACLASS="SECT1"HREF="ch16_10.htm"TITLE="16.10 findcmd: Find a Command in Your Search Path "><IMGSRC="gifs/txtpreva.gif"SRC="gifs/txtpreva.gif"ALT="Previous: 16.10 findcmd: Find a Command in Your Search Path "BORDER="0"></A></TD><TDALIGN="CENTER"VALIGN="TOP"WIDTH="171"><B><FONTFACE="ARIEL,HELVETICA,HELV,SANSERIF"SIZE="-1">Chapter 16<BR>Where Did I Put That?</FONT></B></TD><TDALIGN="RIGHT"VALIGN="TOP"WIDTH="172"><ACLASS="SECT1"HREF="ch16_12.htm"TITLE="16.12 Useful ls Aliases "><IMGSRC="gifs/txtnexta.gif"SRC="gifs/txtnexta.gif"ALT="Next: 16.12 Useful ls Aliases "BORDER="0"></A></TD></TR></TABLE> <HRALIGN="LEFT"WIDTH="515"TITLE="footer"></DIV><DIVCLASS="SECT1"><H2CLASS="sect1"><ACLASS="title"NAME="UPT-ART-1530">16.11 Showing Hidden Files with ls -A and -a </A></H2><PCLASS="para"><ACLASS="indexterm"NAME="AUTOID-17156"></A><ACLASS="indexterm"NAME="AUTOID-17158"></A><ACLASS="indexterm"NAME="AUTOID-17162"></A>The <EMCLASS="emphasis">ls</EM> command normally ignores any files whose names begin witha dot (<CODECLASS="literal">.</CODE>). This is often very convenient: UNIX has lots ofsmall configuration files, scratch files, etc., that you really don'tcare about and don't want to be bothered about most of the time.However, there are some times when you care very much about thesefiles. If you want to see "hidden" files, use the command <EMCLASS="emphasis">ls -a</EM>. For example:<ACLASS="indexterm"NAME="AUTOID-17168"></A></P><PCLASS="para"><BLOCKQUOTECLASS="screen"><PRECLASS="screen">% <CODECLASS="userinput"><B>cd</B></CODE>% <CODECLASS="userinput"><B>ls </B></CODE><EMCLASS="emphasis">Don't show hidden files</EM>Mail mail.txt performance powertools% <CODECLASS="userinput"><B>ls -a </B></CODE><EMCLASS="emphasis">This time, show me EVERYTHING</EM>. .emacs Mail powertools.. .login mail.txt .cshrc .mailrc performance </PRE></BLOCKQUOTE></P><PCLASS="para">With the <EMCLASS="emphasis">-a</EM> option, we see four additional files: the C shellinitialization file, the login initialization file, the customizationfiles for the GNU Emacs editor, and mail. We also see two "special"entries, <CODECLASS="literal">.</CODE> and <CODECLASS="literal">..</CODE>, which represent the current directory and theparent of the current directory.All UNIX directories contain<SPANCLASS="link">these two entries (<ACLASS="linkend"HREF="ch18_02.htm"TITLE="What's Really in a Directory ">18.2</A>)</SPAN>.</P><PCLASS="para">If you don't want to be bothered with <CODECLASS="literal">.</CODE> and <CODECLASS="literal">..</CODE>, manyUNIX systems also have a <EMCLASS="emphasis">-A</EM> option:<ACLASS="indexterm"NAME="AUTOID-17187"></A></P><PCLASS="para"><BLOCKQUOTECLASS="screen"><PRECLASS="screen">% <CODECLASS="userinput"><B>ls -A </B></CODE><EMCLASS="emphasis">Show me everything but . and ..</EM>.cshrc .login Mail performance .emacs .mailrc mail.txt powertools</PRE></BLOCKQUOTE></P><DIVCLASS="sect1info"><PCLASS="SECT1INFO">- <SPANCLASS="authorinitials">ML</SPAN></P></DIV></DIV><DIVCLASS="htmlnav"><P></P><HRALIGN="LEFT"WIDTH="515"TITLE="footer"><TABLEWIDTH="515"BORDER="0"CELLSPACING="0"CELLPADDING="0"><TR><TDALIGN="LEFT"VALIGN="TOP"WIDTH="172"><ACLASS="SECT1"HREF="ch16_10.htm"TITLE="16.10 findcmd: Find a Command in Your Search Path "><IMGSRC="gifs/txtpreva.gif"SRC="gifs/txtpreva.gif"ALT="Previous: 16.10 findcmd: Find a Command in Your Search Path "BORDER="0"></A></TD><TDALIGN="CENTER"VALIGN="TOP"WIDTH="171"><ACLASS="book"HREF="index.htm"TITLE="UNIX Power Tools"><IMGSRC="gifs/txthome.gif"SRC="gifs/txthome.gif"ALT="UNIX Power Tools"BORDER="0"></A></TD><TDALIGN="RIGHT"VALIGN="TOP"WIDTH="172"><ACLASS="SECT1"HREF="ch16_12.htm"TITLE="16.12 Useful ls Aliases "><IMGSRC="gifs/txtnexta.gif"SRC="gifs/txtnexta.gif"ALT="Next: 16.12 Useful ls Aliases "BORDER="0"></A></TD></TR><TR><TDALIGN="LEFT"VALIGN="TOP"WIDTH="172">16.10 findcmd: Find a Command in Your Search Path </TD><TDALIGN="CENTER"VALIGN="TOP"WIDTH="171"><ACLASS="index"HREF="index/idx_0.htm"TITLE="Book Index"><IMGSRC="gifs/index.gif"SRC="gifs/index.gif"ALT="Book Index"BORDER="0"></A></TD><TDALIGN="RIGHT"VALIGN="TOP"WIDTH="172">16.12 Useful ls Aliases </TD></TR></TABLE><HRALIGN="LEFT"WIDTH="515"TITLE="footer"><IMGSRC="gifs/smnavbar.gif"SRC="gifs/smnavbar.gif"USEMAP="#map"BORDER="0"ALT="The UNIX CD Bookshelf Navigation"><MAPNAME="map"><AREASHAPE="RECT"COORDS="0,0,73,21"HREF="../index.htm"ALT="The UNIX CD Bookshelf"><AREASHAPE="RECT"COORDS="74,0,163,21"HREF="index.htm"ALT="UNIX Power Tools"><AREASHAPE="RECT"COORDS="164,0,257,21"HREF="../unixnut/index.htm"ALT="UNIX in a Nutshell"><AREASHAPE="RECT"COORDS="258,0,321,21"HREF="../vi/index.htm"ALT="Learning the vi Editor"><AREASHAPE="RECT"COORDS="322,0,378,21"HREF="../sedawk/index.htm"ALT="sed & awk"><AREASHAPE="RECT"COORDS="379,0,438,21"HREF="../ksh/index.htm"ALT="Learning the Korn Shell"><AREASHAPE="RECT"COORDS="439,0,514,21"HREF="../lrnunix/index.htm"ALT="Learning the UNIX Operating System"></MAP></DIV></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -