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