1LS(1) User Commands LS(1)
2
3
4
6 ls - list directory contents
7
9 ls [OPTION]... [FILE]...
10
12 List information about the FILEs (the current directory by default).
13 Sort entries alphabetically if none of -cftuvSUX nor --sort is speci‐
14 fied.
15
16 Mandatory arguments to long options are mandatory for short options
17 too.
18
19 -a, --all
20 do not ignore entries starting with .
21
22 -A, --almost-all
23 do not list implied . and ..
24
25 --author
26 with -l, print the author of each file
27
28 -b, --escape
29 print C-style escapes for nongraphic characters
30
31 --block-size=SIZE
32 with -l, scale sizes by SIZE when printing them; e.g.,
33 '--block-size=M'; see SIZE format below
34
35 -B, --ignore-backups
36 do not list implied entries ending with ~
37
38 -c with -lt: sort by, and show, ctime (time of last modification of
39 file status information); with -l: show ctime and sort by name;
40 otherwise: sort by ctime, newest first
41
42 -C list entries by columns
43
44 --color[=WHEN]
45 color the output WHEN; more info below
46
47 -d, --directory
48 list directories themselves, not their contents
49
50 -D, --dired
51 generate output designed for Emacs' dired mode
52
53 -f list all entries in directory order
54
55 -F, --classify[=WHEN]
56 append indicator (one of */=>@|) to entries WHEN
57
58 --file-type
59 likewise, except do not append '*'
60
61 --format=WORD
62 across -x, commas -m, horizontal -x, long -l, single-column -1,
63 verbose -l, vertical -C
64
65 --full-time
66 like -l --time-style=full-iso
67
68 -g like -l, but do not list owner
69
70 --group-directories-first
71 group directories before files; can be augmented with a --sort
72 option, but any use of --sort=none (-U) disables grouping
73
74 -G, --no-group
75 in a long listing, don't print group names
76
77 -h, --human-readable
78 with -l and -s, print sizes like 1K 234M 2G etc.
79
80 --si likewise, but use powers of 1000 not 1024
81
82 -H, --dereference-command-line
83 follow symbolic links listed on the command line
84
85 --dereference-command-line-symlink-to-dir
86 follow each command line symbolic link that points to a direc‐
87 tory
88
89 --hide=PATTERN
90 do not list implied entries matching shell PATTERN (overridden
91 by -a or -A)
92
93 --hyperlink[=WHEN]
94 hyperlink file names WHEN
95
96 --indicator-style=WORD
97 append indicator with style WORD to entry names: none (default),
98 slash (-p), file-type (--file-type), classify (-F)
99
100 -i, --inode
101 print the index number of each file
102
103 -I, --ignore=PATTERN
104 do not list implied entries matching shell PATTERN
105
106 -k, --kibibytes
107 default to 1024-byte blocks for file system usage; used only
108 with -s and per directory totals
109
110 -l use a long listing format
111
112 -L, --dereference
113 when showing file information for a symbolic link, show informa‐
114 tion for the file the link references rather than for the link
115 itself
116
117 -m fill width with a comma separated list of entries
118
119 -n, --numeric-uid-gid
120 like -l, but list numeric user and group IDs
121
122 -N, --literal
123 print entry names without quoting
124
125 -o like -l, but do not list group information
126
127 -p, --indicator-style=slash
128 append / indicator to directories
129
130 -q, --hide-control-chars
131 print ? instead of nongraphic characters
132
133 --show-control-chars
134 show nongraphic characters as-is (the default, unless program is
135 'ls' and output is a terminal)
136
137 -Q, --quote-name
138 enclose entry names in double quotes
139
140 --quoting-style=WORD
141 use quoting style WORD for entry names: literal, locale, shell,
142 shell-always, shell-escape, shell-escape-always, c, escape
143 (overrides QUOTING_STYLE environment variable)
144
145 -r, --reverse
146 reverse order while sorting
147
148 -R, --recursive
149 list subdirectories recursively
150
151 -s, --size
152 print the allocated size of each file, in blocks
153
154 -S sort by file size, largest first
155
156 --sort=WORD
157 sort by WORD instead of name: none (-U), size (-S), time (-t),
158 version (-v), extension (-X), width
159
160 --time=WORD
161 change the default of using modification times; access time
162 (-u): atime, access, use; change time (-c): ctime, status; birth
163 time: birth, creation;
164
165 with -l, WORD determines which time to show; with --sort=time,
166 sort by WORD (newest first)
167
168 --time-style=TIME_STYLE
169 time/date format with -l; see TIME_STYLE below
170
171 -t sort by time, newest first; see --time
172
173 -T, --tabsize=COLS
174 assume tab stops at each COLS instead of 8
175
176 -u with -lt: sort by, and show, access time; with -l: show access
177 time and sort by name; otherwise: sort by access time, newest
178 first
179
180 -U do not sort; list entries in directory order
181
182 -v natural sort of (version) numbers within text
183
184 -w, --width=COLS
185 set output width to COLS. 0 means no limit
186
187 -x list entries by lines instead of by columns
188
189 -X sort alphabetically by entry extension
190
191 -Z, --context
192 print any security context of each file
193
194 --zero end each output line with NUL, not newline
195
196 -1 list one file per line
197
198 --help display this help and exit
199
200 --version
201 output version information and exit
202
203 The SIZE argument is an integer and optional unit (example: 10K is
204 10*1024). Units are K,M,G,T,P,E,Z,Y (powers of 1024) or KB,MB,...
205 (powers of 1000). Binary prefixes can be used, too: KiB=K, MiB=M, and
206 so on.
207
208 The TIME_STYLE argument can be full-iso, long-iso, iso, locale, or
209 +FORMAT. FORMAT is interpreted like in date(1). If FORMAT is FOR‐
210 MAT1<newline>FORMAT2, then FORMAT1 applies to non-recent files and FOR‐
211 MAT2 to recent files. TIME_STYLE prefixed with 'posix-' takes effect
212 only outside the POSIX locale. Also the TIME_STYLE environment vari‐
213 able sets the default style to use.
214
215 The WHEN argument defaults to 'always' and can also be 'auto' or
216 'never'.
217
218 Using color to distinguish file types is disabled both by default and
219 with --color=never. With --color=auto, ls emits color codes only when
220 standard output is connected to a terminal. The LS_COLORS environment
221 variable can change the settings. Use the dircolors(1) command to set
222 it.
223
224 Exit status:
225 0 if OK,
226
227 1 if minor problems (e.g., cannot access subdirectory),
228
229 2 if serious trouble (e.g., cannot access command-line argument).
230
232 Written by Richard M. Stallman and David MacKenzie.
233
235 GNU coreutils online help: <https://www.gnu.org/software/coreutils/>
236 Report any translation bugs to <https://translationproject.org/team/>
237
239 Copyright © 2022 Free Software Foundation, Inc. License GPLv3+: GNU
240 GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
241 This is free software: you are free to change and redistribute it.
242 There is NO WARRANTY, to the extent permitted by law.
243
245 dircolors(1)
246
247 Full documentation <https://www.gnu.org/software/coreutils/ls>
248 or available locally via: info '(coreutils) ls invocation'
249
250
251
252GNU coreutils 9.1 January 2023 LS(1)