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 with -l, show time as WORD instead of default modification time:
167 atime or access or use (-u); ctime or status (-c); also use
168 specified time as sort key if --sort=time (newest first)
169
170 --time-style=TIME_STYLE
171 time/date format with -l; see TIME_STYLE below
172
173 -t sort by modification time, newest first
174
175 -T, --tabsize=COLS
176 assume tab stops at each COLS instead of 8
177
178 -u with -lt: sort by, and show, access time; with -l: show access
179 time and sort by name; otherwise: sort by access time, newest
180 first
181
182 -U do not sort; list entries in directory order
183
184 -v natural sort of (version) numbers within text
185
186 -w, --width=COLS
187 set output width to COLS. 0 means no limit
188
189 -x list entries by lines instead of by columns
190
191 -X sort alphabetically by entry extension
192
193 -Z, --context
194 print any security context of each file
195
196 -1 list one file per line. Avoid '\n' with -q or -b
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).
206
207 The TIME_STYLE argument can be full-iso, long-iso, iso, locale, or
208 +FORMAT. FORMAT is interpreted like in date(1). If FORMAT is FOR‐
209 MAT1<newline>FORMAT2, then FORMAT1 applies to non-recent files and FOR‐
210 MAT2 to recent files. TIME_STYLE prefixed with 'posix-' takes effect
211 only outside the POSIX locale. Also the TIME_STYLE environment vari‐
212 able sets the default style to use.
213
214 Using color to distinguish file types is disabled both by default and
215 with --color=never. With --color=auto, ls emits color codes only when
216 standard output is connected to a terminal. The LS_COLORS environment
217 variable can change the settings. Use the dircolors command to set it.
218
219 Exit status:
220 0 if OK,
221
222 1 if minor problems (e.g., cannot access subdirectory),
223
224 2 if serious trouble (e.g., cannot access command-line argument).
225
227 Written by Richard M. Stallman and David MacKenzie.
228
230 GNU coreutils online help: <https://www.gnu.org/software/coreutils/>
231 Report ls translation bugs to <https://translationproject.org/team/>
232
234 Copyright © 2018 Free Software Foundation, Inc. License GPLv3+: GNU
235 GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
236 This is free software: you are free to change and redistribute it.
237 There is NO WARRANTY, to the extent permitted by law.
238
240 Full documentation at: <https://www.gnu.org/software/coreutils/ls>
241 or available locally via: info '(coreutils) ls invocation'
242
243
244
245GNU coreutils 8.30 July 2018 LS(1)