1
0
Fork 0
mirror of https://github.com/tldr-pages/tldr.git synced 2025-07-02 08:55:23 +02:00
tldr/pages/common/ls.md

37 lines
912 B
Markdown
Raw Normal View History

2014-01-28 10:27:02 +01:00
# ls
> List directory contents.
2024-12-16 07:45:08 -08:00
> More information: <https://www.gnu.org/software/coreutils/manual/html_node/ls-invocation.html>.
2014-01-28 10:27:02 +01:00
- List files one per line:
2014-01-28 10:27:02 +01:00
`ls -1`
2014-01-28 10:27:02 +01:00
2025-03-12 21:05:58 +02:00
- List all files, including hidden files:
2014-01-28 10:27:02 +01:00
2025-03-12 21:05:58 +02:00
`ls {{[-a|--all]}}`
2014-01-28 10:27:02 +01:00
- List files with a trailing symbol to indicate file type (directory/, symbolic_link@, executable*, ...):
2025-03-12 21:05:58 +02:00
`ls {{[-F|--classify]}}`
2025-03-12 21:05:58 +02:00
- List all files in [l]ong format (permissions, ownership, size, and modification date):
2014-01-28 10:27:02 +01:00
2025-03-12 21:05:58 +02:00
`ls {{[-la|--all -l]}}`
2014-01-28 21:58:16 +00:00
2025-03-12 21:05:58 +02:00
- List files in [l]ong format with size displayed using human-readable units (KiB, MiB, GiB):
2025-03-12 21:05:58 +02:00
`ls {{[-lh|-l --human-readable]}}`
2025-03-12 21:05:58 +02:00
- List files in [l]ong format, sorted by [S]ize (descending) recursively:
2014-02-21 14:05:52 -08:00
2025-03-12 21:05:58 +02:00
`ls {{-lSR|-lS --recursive}}`
2025-03-12 21:05:58 +02:00
- List files in [l]ong format, sorted by [t]ime the file was modified and in reverse order (oldest first):
2016-01-27 16:44:05 +00:00
2025-03-12 21:05:58 +02:00
`ls {{[-ltr|-lt --reverse]}}`
2021-05-14 03:40:50 +03:00
2025-03-12 21:05:58 +02:00
- Only list directories:
2021-05-14 03:40:50 +03:00
2025-03-12 21:05:58 +02:00
`ls {{[-d|--directory]}} */`