ls command
List files and directories with sizes, permissions and dates.
- Files & directories
- Package coreutils
- 10 options · 8 examples
Syntax
ls [options] [path…]Provided by the coreutils package. Run man ls for the full manual.
Common options
| Option | What it does |
|---|---|
-l | Long format: permissions, owner, size, date |
-a | Show hidden files (names starting with a dot) |
-h | Human-readable sizes (K, M, G) with -l |
-t | Sort by modification time, newest first |
-r | Reverse the sort order |
-S | Sort by file size, largest first |
-R | List subdirectories recursively |
-d | List the directory itself, not its contents |
-1 | One name per line |
--color=auto | Colour file types |
Examples
List files with details and human-readable sizes
ls -lhInclude hidden files
ls -laNewest files first
ls -ltOldest files first
ls -ltrLargest files first
ls -lhSOnly directories in the current folder
ls -d */List a directory recursively
ls -R /etc/nginxCount the files in a directory
ls -1 | wc -l
No example matches. Check the options table or search the guides.
Tips
llis a common alias forls -alFon Ubuntu.- Don't parse
lsoutput in scripts; usefindor a shell glob instead.
ls guides
- The `ls` Command in Linux with Practical Examples Linux Commands · Updated Apr 2025
