Forever & AlwaysLINUX COMMAND ATLAS

LINUX COMMAND ATLAS · COMMAND GUIDE

Linux ls command

List files and folders. Add flags to show hidden files and details.

GNU Coreutils

Syntax

Command form
ls [OPTION]... [FILE]...

Common options

12 options
OptionWhat it does
-a, --allInclude names beginning with a dot.
-A, --almost-allInclude hidden names, except . and ...
-lUse a long listing with permissions, owner, size and time.
-h, --human-readableWith -l, show sizes in readable units.
-R, --recursiveList subdirectories recursively.
-tSort by modification time, newest first.
-r, --reverseReverse the selected sort order.
-SSort by file size, largest first.
-d, --directoryList directories themselves, not their contents.
-F, --classifyAppend a type marker such as / to directories.
--color[=WHEN]Control coloured output: always, never or auto.
--time-style=STYLEChoose the timestamp format in long listings.

Usage examples

3 examples

List files and folders. Add flags to show hidden files and details.

ls -lah

Show hidden entries and readable file sizes in long format.

ls -lah /var/log

Sort by newest modification time using an ISO-like date format.

ls -lt --time-style=long-iso

Notes

GNU ls has many options; output and available flags can differ on BSD and minimal systems.