Linux ls Command
The ls command with the flags that matter, sorting and colour options, and the combinations experienced users actually type every day.
Formula
ls [OPTION]... [FILE]...
How to use it
- The synopsis at the top shows the general form of the command.
- Click any example to copy it straight to your clipboard.
- The options table lists only the flags worth remembering — run man for the exhaustive list.
Examples
| ls -lh | long listing with readable file sizes |
| ls -la | everything, including hidden files |
| ls -lt | newest files first — what changed recently |
Questions people ask
What do the letters in drwxr-xr-x mean?
The first character is the type — d for directory, - for a regular file, l for a symlink. The next nine are read, write and execute permissions for the owner, the group and everyone else.
How do I sort by size?
ls -lSh sorts largest first. Add -r to reverse it, so the biggest ends up at the bottom next to your prompt.
Does this page work offline?
Yes, after the first visit. The whole reference is part of the page and the service worker caches it.
Runs entirely in your browser. Nothing you type is uploaded, logged or shared.
Last updated 22 August 2026