Command ls
List a directory or describe one regular file.
Synopsis
ls [path]Ordinary invocation: foreground child, PID 3; the shell waits. Allowed as a pipe producer.
Parameters
| Parameter | Meaning |
|---|---|
path | Optional absolute or relative path; default is the current directory. |
Description
For a regular file, prints its name and length in bytes. For a directory, prints its immediate children: directories have a trailing slash; files have their byte length.
The virtual directories /, /dev and /mnt have fixed listings. A name in /dev or /mnt is not proof that its hardware is available.
Normal volume listings pause after each eight entries. The [BK] prompt accepts a key to continue. In a pipeline this internal pause is disabled; the consumer controls paging. Entries follow inode order, without sorting.
Examples
ls
ls /mnt/smp1
ls /mnt/smp1/demo.bas
ls /mnt/smp1 | lessLimits and side effects
- No options, recursive listing, glob expansion, timestamps or permission columns. Use the documented single-path form.
Status and diagnostics
Success is status 0. Relevant status codes: 3, 4, 6, 8, 14, 18. See the diagnostic reference.
See also
cd · pwd · less · devices · Shell syntax