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 change of file
39 status information); with -l: show ctime and sort by name; oth‐
40 erwise: 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 select which timestamp used to display or sort; access time
162 (-u): atime, access, use; metadata change time (-c): ctime, sta‐
163 tus; modified time (default): mtime, modification; birth time:
164 birth, creation;
165
166 with -l, WORD determines which time to show; with --sort=time,
167 sort by WORD (newest first)
168
169 --time-style=TIME_STYLE
170 time/date format with -l; see TIME_STYLE below
171
172 -t sort by time, newest first; see --time
173
174 -T, --tabsize=COLS
175 assume tab stops at each COLS instead of 8
176
177 -u with -lt: sort by, and show, access time; with -l: show access
178 time and sort by name; otherwise: sort by access time, newest
179 first
180
181 -U do not sort; list entries in directory order
182
183 -v natural sort of (version) numbers within text
184
185 -w, --width=COLS
186 set output width to COLS. 0 means no limit
187
188 -x list entries by lines instead of by columns
189
190 -X sort alphabetically by entry extension
191
192 -Z, --context
193 print any security context of each file
194
195 --zero end each output line with NUL, not newline
196
197 -1 list one file per line
198
199 --help display this help and exit
200
201 --version
202 output version information and exit
203
204 The SIZE argument is an integer and optional unit (example: 10K is
205 10*1024). Units are K,M,G,T,P,E,Z,Y,R,Q (powers of 1024) or KB,MB,...
206 (powers of 1000). Binary prefixes can be used, too: KiB=K, MiB=M, and
207 so on.
208
209 The TIME_STYLE argument can be full-iso, long-iso, iso, locale, or
210 +FORMAT. FORMAT is interpreted like in date(1). If FORMAT is FOR‐
211 MAT1<newline>FORMAT2, then FORMAT1 applies to non-recent files and FOR‐
212 MAT2 to recent files. TIME_STYLE prefixed with 'posix-' takes effect
213 only outside the POSIX locale. Also the TIME_STYLE environment vari‐
214 able sets the default style to use.
215
216 The WHEN argument defaults to 'always' and can also be 'auto' or
217 'never'.
218
219 Using color to distinguish file types is disabled both by default and
220 with --color=never. With --color=auto, ls emits color codes only when
221 standard output is connected to a terminal. The LS_COLORS environment
222 variable can change the settings. Use the dircolors(1) command to set
223 it.
224
225 Exit status:
226 0 if OK,
227
228 1 if minor problems (e.g., cannot access subdirectory),
229
230 2 if serious trouble (e.g., cannot access command-line argument).
231
233 Written by Richard M. Stallman and David MacKenzie.
234
236 GNU coreutils online help: <https://www.gnu.org/software/coreutils/>
237 Report any translation bugs to <https://translationproject.org/team/>
238
240 Copyright © 2023 Free Software Foundation, Inc. License GPLv3+: GNU
241 GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
242 This is free software: you are free to change and redistribute it.
243 There is NO WARRANTY, to the extent permitted by law.
244
246 dircolors(1)
247
248 Full documentation <https://www.gnu.org/software/coreutils/ls>
249 or available locally via: info '(coreutils) ls invocation'
250
251
252
253GNU coreutils 9.3 September 2023 LS(1)