LinuxCommandLibrary

ls

lists directory contents

TLDR

List files

$ ls
copy
List with details
$ ls -l
copy
List all including hidden
$ ls -la
copy
Human readable sizes
$ ls -lh
copy
Sort by time
$ ls -lt
copy
Sort by size
$ ls -lS
copy
Recursive listing
$ ls -R
copy

SYNOPSIS

ls [options] [files]

DESCRIPTION

ls lists directory contents. It shows files, directories, and their attributes.
The tool is one of the most used Unix commands. Options control format, sorting, and filtering.

PARAMETERS

FILES

Files or directories to list.
-l
Long listing format.
-a
Include hidden files.
-h
Human readable sizes.
-t
Sort by modification time.
-S
Sort by size.
-R
Recursive listing.
-r
Reverse sort order.
--help
Display help information.

CAVEATS

Output varies by implementation. Colors need terminal support. Hidden files start with dot.

HISTORY

ls dates back to the original Unix system at AT&T Bell Labs in 1971, remaining a fundamental command.

SEE ALSO

dir(1), exa(1), lsd(1), tree(1)

> TERMINAL_GEAR

Curated for the Linux community

Copied to clipboard

> TERMINAL_GEAR

Curated for the Linux community