LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

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. Without arguments, it lists the current directory. With -l, it shows permissions, owner, size, and modification time for each entry.
Entries are sorted alphabetically by default. Sorting can be changed with -t (time), -S (size), or -r (reverse). The --color option highlights files by type (directories, executables, symlinks).

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.
-1
One file per line.
-d
List directories themselves, not contents.
--color WHEN
Colorize output (auto, always, never).
-i
Print inode number.
-F, --classify
Append indicator (/ for dirs, * for executables).

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)

Copied to clipboard
Kai