Listing Directories

Listing the contents of directories, like navigating through your system, is a basic skill you should quickly master. The following sections describe several directory listing programs that are usually included with most Linux distributions.

Listing Directories and Files with the ls Command

Use the ls (list directory) command to list the contents of one or several directories. This command has more than 40 different command-line options that can be combined to format listings. Wildcards can be used to specify certain files or directories. To list the contents of the /usr/local/ directory, type the following:

$ ls /usr/local/
bin      etc      info     lib      qt       src
doc      games    lesstif  man      sbin

By default, the ls command lists the contents of ...

Get Practical Linux 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.