Listing directory contents
The ls command lists the contents of a directory. To see
the contents of your working directory, enter:
ls
To list
the contents of a different directory, add the relative or absolute
name of the directory you want to look at, as in:
ls dira/dirb
ls abc/def/ghi
ls displays directory contents in alphabetic
order. Typical ls output looks like:
bin csrb.cpy fifotest makefl temp.t
cc etc helplist phones.com totals
ls does
not normally distinguish between directories, regular files, and special
files. If you want a list of directory contents that distinguishes
between file types, use the -F option. Entering:
ls –F
gives you output in the form:
bin/ csrb.cpy fifotest| makefl/ temp.t
cc/ etc/ helplist phones.com* totals/
The
symbols following the file names indicate the type of file:
- /
- Directory
- *
- Executable file
- |
- FIFO special file
- @
- Symbolic link
- &;
- External link
ls can list the contents of more than one directory at
a time. For example:
ls dir1 dir2
lists the contents of
the two given directories, one after the other. Try this command on
a pair of directories to see what format ls uses.The ls command with the -E option displays a
character indicating whether or not the program is loaded from the
shared library region. If the program is from the shared library region,
an 'l' will appear as the fourth character in the second column. If
the program is not from the shared library region, a '-' will appear.
For example:
total 11
-rwxr-xr-x -ps- 1 FRED SYS1 101 Oct 02 16:30 james
-rwxrwxrwx a-s- 1 FRED SYS1 654 Oct 02 16:30 backup
-rwxr-xr-x a--- 1 FRED SYS1 40 Oct 02 16:30 temp
-rwxr--r-- ap-l 1 FRED SYS1 562 Oct 02 16:34 diag
-rwxr--r-- --sl 1 FRED SYS1 106 Oct 02 16:53 bird
In this example, the files james, backup, and temp are not loaded from the shared library region, but the files diag and bird are.