UNIX Power Tools

UNIX Power ToolsSearch this book
Previous: 16.10 findcmd: Find a Command in Your Search Path Chapter 16
Where Did I Put That?
Next: 16.12 Useful ls Aliases
 

16.11 Showing Hidden Files with ls -A and -a

The ls command normally ignores any files whose names begin with a dot (.). This is often very convenient: UNIX has lots of small configuration files, scratch files, etc., that you really don't care about and don't want to be bothered about most of the time. However, there are some times when you care very much about these files. If you want to see "hidden" files, use the command ls -a. For example:

% cd
% ls            Don't show hidden files
Mail       mail.txt      performance   powertools
% ls -a            This time, show me EVERYTHING
.        .emacs        Mail          powertools
..       .login        mail.txt      
.cshrc   .mailrc       performance     

With the -a option, we see four additional files: the C shell initialization file, the login initialization file, the customization files for the GNU Emacs editor, and mail. We also see two "special" entries, . and .., which represent the current directory and the parent of the current directory. All UNIX directories contain these two entries (18.2).

If you don't want to be bothered with . and .., many UNIX systems also have a -A option:

% ls -A   Show me everything but . and ..
.cshrc   .login        Mail          performance 
.emacs   .mailrc       mail.txt      powertools

- ML


Previous: 16.10 findcmd: Find a Command in Your Search Path UNIX Power ToolsNext: 16.12 Useful ls Aliases
16.10 findcmd: Find a Command in Your Search Path Book Index16.12 Useful ls Aliases

The UNIX CD Bookshelf NavigationThe UNIX CD BookshelfUNIX Power ToolsUNIX in a NutshellLearning the vi Editorsed & awkLearning the Korn ShellLearning the UNIX Operating System