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

A list of the contents of the subdirectory you typed appears (Figure 5).

Figure 5. A listing for the library subdirectory.


To view a long directory listing

Type ls -l and press .

A list of the contents of your home directory, including permissions, owner, size, and modification date information, appears (Figure 6).

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


Tip

  • I tell you more about permissions later in this chapter.


To include invisible items in a directory listing

Type ls -a and press .

A list of the contents of your home directory, including invisible items, appears (Figure 7).

Figure 7. A directory listing that includes invisible subdirectories.




Visual QuickStart Guide. Mac OS X 10. 4 Tiger
Mac Os X 10.4 Tiger (Visual Quickstart Guides)
ISBN: 0321423372
EAN: 2147483647
Year: 2003
Pages: 301
Authors: Maria Langer

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net