- 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
Visually Display a File’s Type
ls -F
The ls command doesn’t tell you much about an item in a directory besides its name. By itself, it’s hard to tell if an item is a file, a directory, or something else. An easy way to solve this problem and make ls really informative is to use the -F option (or --classify).
$ ls -F ~/bin adblock_filters.txt fixm3u* pix2tn.pl* addext* flash.xml* pop_login* address_book.csv getip* procmail/ address_book.sxc homesize* programs_usual* address_book.xls html2text.py* quickrename* backup_to_chaucer* list-urls.py*
This tells you quite a bit. An * or asterisk after a file means that it is executable, while a / or forward slash indicates a directory. If the filename lacks any sort of appendage at all, it’s just a regular ol’ file. Other possible endings are shown in Table 2.1.
Table 2.1 Symbols and File Types
Character |
Meaning |
* |
Executable |
/ |
Directory |
@ |
Symbolic link |
| |
FIFO (AKA a named pipe) |
= |
Socket |