- List Files and Folders
- List the Contents of Other Folders
- List Folder Contents Using Wildcards
- View a List of Files in Subfolders
- View a List of Contents in a Single Column
- View Contents As a Comma-Separated List
- View Hidden Files and Folders
- Visually Display a File's Type
- Display Contents in Color
- List Permissions, Ownership, and More
- Reverse the Order Contents Are Listed
- Sort Contents by Date and Time
- Sort Contents by Size
- Express File Sizes in Terms of K, M, and G
- Display the Path of Your Current Directory
- Change to a Different Directory
- Change to Your Home Directory
- Change to Your Previous Directory
- Conclusion
View Hidden Files and Folders
ls -a
Up to this point, you’ve been viewing the visible files in directories, but don’t forget that many directories contain hidden files in them as well. Your home directory, for instance, is just bursting with hidden files and folders, all made invisible by the placement of a . at the beginning of their names. If you want to view these hidden elements, just use the -a option (or --all).
$ ls -a ~/ . .gimp-2.2 .openoffice.org1.9.95 .. .gksu.lock .openoffice.org1.9 .3ddesktop .glade2 .openoffice.org2 .abbrev_defs .gnome .opera .acrorc .gnome2 .padminrc .adobe .gnome2_private pictures alias .gnome_private podcasts [List condensed due to length]
You should know several things about this listing. First, ls -a displays both hidden and unhidden items, so you see both .gnome and pictures. Second, you’ll always see the . and .. because . refers to the current directory, while .. points to the directory above this one, the parent directory. These two hidden files exist in every single folder on your system, and you can’t get rid of them. Expect to see them every time you use the -a option. Finally, depending on the directory, the -a option can reveal a great number of hidden items of which you weren’t aware.