2014-01-28 09:27:02 +00:00
|
|
|
# ls
|
|
|
|
|
2016-01-07 17:31:27 +00:00
|
|
|
> List directory contents.
|
2021-04-01 16:54:26 +01:00
|
|
|
> More information: <https://www.gnu.org/software/coreutils/ls>.
|
2014-01-28 09:27:02 +00:00
|
|
|
|
2016-01-20 11:39:15 +00:00
|
|
|
- List files one per line:
|
2014-01-28 09:27:02 +00:00
|
|
|
|
2016-01-20 11:39:15 +00:00
|
|
|
`ls -1`
|
2014-01-28 09:27:02 +00:00
|
|
|
|
2016-01-20 11:39:15 +00:00
|
|
|
- List all files, including hidden files:
|
2014-01-28 09:27:02 +00:00
|
|
|
|
2016-01-20 11:39:15 +00:00
|
|
|
`ls -a`
|
2014-01-28 09:27:02 +00:00
|
|
|
|
2020-05-27 15:17:56 +01:00
|
|
|
- List all files, with trailing `/` added to directory names:
|
|
|
|
|
|
|
|
`ls -F`
|
|
|
|
|
2021-02-03 17:37:37 +00:00
|
|
|
- Long format list (permissions, ownership, size, and modification date) of all files:
|
2014-01-28 09:27:02 +00:00
|
|
|
|
2016-01-20 11:39:15 +00:00
|
|
|
`ls -la`
|
2014-01-28 21:58:16 +00:00
|
|
|
|
2021-08-15 18:59:09 +01:00
|
|
|
- Long format list with size displayed using human-readable units (KiB, MiB, GiB):
|
2014-04-16 19:24:01 +01:00
|
|
|
|
|
|
|
`ls -lh`
|
|
|
|
|
2024-01-12 19:19:20 +00:00
|
|
|
- Long format list sorted by size (descending) recursively:
|
2014-02-21 22:05:52 +00:00
|
|
|
|
2024-01-12 19:19:20 +00:00
|
|
|
`ls -lSR`
|
2016-01-27 16:31:40 +00:00
|
|
|
|
|
|
|
- Long format list of all files, sorted by modification date (oldest first):
|
2016-01-27 16:44:05 +00:00
|
|
|
|
2016-01-27 16:31:40 +00:00
|
|
|
`ls -ltr`
|
2021-05-14 01:40:50 +01:00
|
|
|
|
|
|
|
- Only list directories:
|
|
|
|
|
2021-10-13 07:26:17 +01:00
|
|
|
`ls -d */`
|