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