Datasheet
5. You can display more information about the files in your home directory by passing additional
arguments, called flags, into
ls. By using ls –l, you can build what is often called a long list.
Again, your results may differ from what is printed here:
Macintosh:~ sample$ ls -l
total 0
drwx------ 3 sample sample 102 16 May 01:20 Desktop
drwx------ 3 sample sample 102 16 May 01:20 Documents
drwx------ 17 sample sample 578 16 May 01:20 Library
drwx------ 3 sample sample 102 16 May 01:20 Movies
drwx------ 4 sample sample 136 16 May 01:20 Music
drwx------ 3 sample sample 102 16 May 01:20 Pictures
drwxr-xr-x 4 sample sample 136 16 May 01:20 Public
drwxr-xr-x 5 sample sample 170 16 May 01:20 Sites
6. You can view the contents of a specific directory by specifying its name as the argument to ls.
Note that this argument can co-exist with other flags you might want to use:
Macintosh:~ sample$ ls -l Library
total 0
drwx------ 2 sample sample 68 16 May 01:20 Application Support
drwx------ 2 sample sample 68 16 May 01:20 Assistants
drwx------ 4 sample sample 136 16 May 01:20 Audio
drwx------ 3 sample sample 102 16 May 01:20 Caches
drwx------ 2 sample sample 68 16 May 01:20 ColorPickers
drwx------ 3 sample sample 102 16 May 01:20 Favorites
drwx------ 11 sample sample 374 16 May 01:20 FontCollections
drwx------ 2 sample sample 68 16 May 01:20 Fonts
drwx------ 2 sample sample 68 16 May 01:20 Internet Plug-Ins
drwx------ 2 sample sample 68 16 May 01:20 Keyboard Layouts
drwx------ 8 sample sample 272 16 May 01:20 Preferences
drwx------ 2 sample sample 68 16 May 01:20 Printers
drwx------ 2 sample sample 68 16 May 01:20 Sounds
drwx------ 4 sample sample 136 16 May 01:20 iMovie
7. Two new questions immediately come to mind: exactly what is ls -l telling you, and what
other flags can you pass into
ls? The answer to both of these questions resides in Darwin’s
online help system, which is better known as the Unix Manual. You can consult the manual by
using the
man command and including the name of another command as the argument:
Macintosh:~ sample$ man ls
LS(1) BSD General Commands Manual LS(1)
NAME
ls - list directory contents
SYNOPSIS
ls [-ABCFGHLPRTWZabcdfghiklmnopqrstuwx1] [file ...]
DESCRIPTION
For each operand that names a file of a type other than directory, ls
displays its name as well as any requested, associated information. For
each operand that names a file of type directory, ls displays the names
of files contained within that directory, as well as any requested, asso-
ciated information.
10
Chapter 1
05_573993 ch01.qxd 6/16/05 2:22 PM Page 10