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.

✓ Tip

  • 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 .

A list of the contents of your home directory appears (Figure 4).

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 ...

Get Mac OS X 10.4 Tiger: Visual QuickStart Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.