Listing Directories and Files with ls (More Goodies) If you've been following along, you're probably an expert at using ls to list directory contents and to verify that files and directories were copied as you intended. ls, though, has a couple more handy uses. In particular, you can also use it to List filenames and information, which is handy for differentiating similar files (Figure 2.1). Figure 2.1. Use ls -l to get extra information about the directories and files in a specific directory. List all files in a directory, including hidden ones, such as .profile and .login configuration files (Code Listing 2.5). See Chapter 8 for more about configuration files. To list filenames and information: To list all files in a directory: ls -la Enter ls -a at the shell prompt to list all the files in the directory, including hidden files, with full information, as shown in Code Listing 2.7. Tips You can hide files by giving them a name that starts with a dot (.). That is, profile would not be hidden, but .profile would be. Remember, you can combine any flags to specify multiple options. For example, if you want to list all files (-a) in the long format (-l) you would use ls -la. Try ls ltR to get the complete listing of your current directory, the directories it contains, and so forth until you run out of subdirectories to descend into. Code Listing 2.7. If you want to see everything, use ls -la. $ ls -la total 22 drwxrwxr-x 3 ejr users 1024 Jun 29 13:07 . drwxrwx- 7 ejr users 1024 Jun 29 12:16 .. -rw-rw-r 1 ejr users 6718 Jun 29 13:00 .stats -rw-rw-r 1 ejr users 2151 Jun 29 12:26 current -rw-rw-r 2 ejr users 1475 Jun 29 12:35 deb.schedule -rw-rw-r 1 ejr users 4567 Jun 29 12:26 new.ideas drwxrwxr-x 2 ejr users 1024 Jun 29 13:06 other -rw-rw-r 1 ejr users 1475 Jun 29 12:22 schedule $ | |