ls

List directory contents with optional detail and sorting.

low risk

interactive breakdown — edit the command and press Explain
$ 
What it does

ls reads directory entries and displays them. With -l it shows permissions, ownership, size, and timestamps. -a reveals hidden dotfiles. Pipe to grep or awk for filtering. Colors are controlled by LS_COLORS.

Common flags
FlagMeaning
-lLong format: permissions, links, owner, size, date
-a --allShow hidden files (starting with .)
-h --human-readablePrint sizes as K, M, G instead of bytes
-tSort by modification time, newest first
-R --recursiveList subdirectories recursively
-SSort by file size, largest first
Examples
ls -lah /var/logShow all files including hidden with human-readable sizes in /var/log · explain & risk-check →
ls -lt /tmp | head -20Show the 20 most recently modified files in /tmp · explain & risk-check →
ls -lS /usr/bin | tail -10Show the 10 smallest binaries in /usr/bin · explain & risk-check →
Pro tip

Use `ls --color=always | less -R` to get colorized output inside less without losing terminal color codes.

Related
find tree du stat
Open the full explainer →More in Files & Archives

Reference text is hand-written and may be incomplete — check man ls for your version. Test destructive commands on a non-production system first.