ls command in Linux: list directory contents
Updated July 3, 2026
The ls command shows what is in a directory: its files and subdirectories.
Syntax
ls [options] [path]With no arguments ls prints the current directory.
Common cases
ls # the current directory
ls -l # long format: permissions, owner, size, date
ls -a # show hidden files too (names that start with a dot)
ls -lh # human-readable sizes: K, M, G
ls -lt # sort by time, newest firstHow it works: what a hidden file is
Linux has no separate 'hidden' attribute. A file is hidden simply because its name starts with a dot, for example
.bashrc.lsdoes not print those by default, whilels -aprints everything.
Try it
Open the sandbox: a real throwaway Linux terminal in your browser. Run the commands above by hand. The container is deleted when you leave, so there is nothing to be afraid of breaking.
Where this is in the book: the chapter The filesystem and moving around.