Listing Directory Contents with the ls Command
ls is one of the most basic Unix commands. It enables you to list the contents of a directory.
- The commands in this section assume that the shell prompt is displaying your home directory (~).
To list the contents of your home directory
Type ls and press

Figure 4. A simple directory listing using the
ls command.
To list the contents of a subdirectory
Type ls followed by the subdirectory name (for example, ls Library) and press

Figure 5. A listing for the library subdirectory.

To view a long directory listing
Type ls -l and press

Figure 6. The long version of a directory listing includes permission, owner, file size, and modification date information.

- I tell you more about permissions later in this chapter.
To include invisible items in a directory listing
Type ls -a and press

Figure 7. A directory listing that includes invisible subdirectories.
