commands.sh
⌘K

ls

all

List directory contents.

More info →

Options (7)

-a, --allboolean

List all files, including hidden files

Example: ls {{[-a|--all]}}
-F, --classifyboolean

List files with a trailing symbol to indicate file type (directory/, symbolic_link@, executable*, ...)

Example: ls {{[-F|--classify]}}
boolean

List all files in [l]ong format (permissions, ownership, size, and modification date)

Example: ls {{[-la|-l --all]}}
boolean

List files in [l]ong format with size displayed using human-readable units (KiB, MiB, GiB)

Example: ls {{[-lh|-l --human-readable]}}
boolean

List files in [l]ong format, sorted by [S]ize (descending) recursively

Example: ls {{[-lSR|-lS --recursive]}}
boolean

List files in [l]ong format, sorted by [t]ime the file was modified and in reverse order (oldest first)

Example: ls {{[-ltr|-lt --reverse]}}
-d, --directoryboolean

Only list directories

Example: ls {{[-d|--directory]}} */

Examples (8)

List files one per line

ls -1

List all files, including hidden files

ls [-a|--all]

List files with a trailing symbol to indicate file type (directory/, symbolic_link@, executable*, ...)

ls [-F|--classify]

List all files in [l]ong format (permissions, ownership, size, and modification date)

ls [-la|-l --all]

List files in [l]ong format with size displayed using human-readable units (KiB, MiB, GiB)

ls [-lh|-l --human-readable]

List files in [l]ong format, sorted by [S]ize (descending) recursively

ls [-lSR|-lS --recursive]

List files in [l]ong format, sorted by [t]ime the file was modified and in reverse order (oldest first)

ls [-ltr|-lt --reverse]

Only list directories

ls [-d|--directory] */
made by @shridhargupta | data from tldr-pages