ls - List directory contents
ls [ options ] directory…
Ls lists the files in one or more directories. If no directory is given, files in the current working directory are shown. Without options, ls displays the filenames in a directory in five columns, sorted alphabetically.
Ls takes a variety of options:
displays all files in the directory, including the “hidden” files.
displays a “long” directory, showing file information for each filename.
Example:
total 4 for 821 bytes
-rw- txt 258 13-aug-85 23:11 dead.letter
drw- dir 512 19-aug-85 00:42 letters
-rw- txt 33 14-aug-85 20:46 patch
-rwx cmd 18 12-aug-85 16:43 login
The first line shows the number of files within the directory and the amount
of space (in bytes) occupied by them. For each line of file information:
-rwx cmd 18 12-aug-85 16:43 login
| | | | |
| | | | name of file
| | | |
| | | date file was last modified
| | |
| | size of file (in bytes)
| |
| file type
|
d--- indicates a directory
-r-- file can be read by owner
--w- file can be written to by owner
---x file can be executed by owner
reports the number of files in the specified directory.
causes a long directory to express all size values in 512 byte blocks, instead of bytes.
marks subdirectory files with a trailing ‘/’, and executable files with a trailing ‘*’.
displays a directory in standard ProDOS format (full display, all information). This option supersedes all others.
shows only invisible files (not available with the -l option).
In all forms except -p, ls supports output redirection to files. Example:
ls /heartbeat/city >file.list
This redirects the columnar output from ls on the /heartbeat/city directory into the file “file.list”.
“(more files exist than shown)” — Too many files exist in the directory and all their names could not be read into memory. If the ‘-p’ option is used, there is no file count limitation.