The Linux ls Command: List Files Like a Pro
The ls command lists files and directories in your current folder. Run on its own, ls prints the names of everything in the working directory. With the right options it shows sizes, permissions, owners and the newest files first — the combinations below cover most real usage.
List files in the current directory
Plain ls shows file and folder names, sorted alphabetically. It is the first command most Linux users learn.
Show details with -l
The long format adds permissions, owner, group, size and the last-modified date for every entry. This is the format you want when checking who owns a file or when it was changed.
Reveal hidden files with -a
Files whose names start with a dot, like .bashrc or .ssh, are hidden. Add -a to show them. The handy -A shows hidden files but leaves out the . and .. entries.
Human-readable sizes with -h
Long listings show sizes in bytes, which are hard to read. Add -h and ls prints 4.0K, 1.2M or 3.4G instead. Use it together with -l.
For the total size of a folder including everything inside it, see du.
Sort by time and reverse the order
To see the most recently modified files at the top, sort by modification time with -t. Reverse any sort with -r, for example the oldest files first.
Combine everything in one go with ls -lah. The ls reference page documents all options.
Keep learning
Related guides: How to Copy Files and Directories with the Linux cp Command · How to Find Files and Directories with the Linux find Command · How to Check Disk Usage with df and du. Read all tutorials on the Learn Linux blog.