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 scale sizes by SIZE before printing them; e.g., '--block-size=M'
33 prints sizes in units of 1,048,576 bytes; 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 'never', 'auto', or 'always'
46 (the default); 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, print sizes in human readable format (e.g., 1K 234M 2G)
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 --indicator-style=WORD
98 append indicator with style WORD to entry names: none (default),
99 slash (-p), file-type (--file-type), classify (-F)
100
101 -i, --inode
102 print the index number of each file
103
104 -I, --ignore=PATTERN
105 do not list implied entries matching shell PATTERN
106
107 -k, --kibibytes
108 default to 1024-byte blocks for disk usage
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 raw entry names (don't treat e.g. control characters spe‐
124 cially)
125
126 -o like -l, but do not list group information
127
128 -p, --indicator-style=slash
129 append / indicator to directories
130
131 -q, --hide-control-chars
132 print ? instead of nongraphic characters
133
134 --show-control-chars
135 show nongraphic characters as-is (the default, unless program is
136 'ls' and output is a terminal)
137
138 -Q, --quote-name
139 enclose entry names in double quotes
140
141 --quoting-style=WORD
142 use quoting style WORD for entry names: literal, locale, shell,
143 shell-always, c, escape
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
155
156 --sort=WORD
157 sort by WORD instead of name: none (-U), size (-S), time (-t),
158 version (-v), extension (-X)
159
160 --time=WORD
161 with -l, show time as WORD instead of default modification time:
162 atime or access or use (-u) ctime or status (-c); also use spec‐
163 ified time as sort key if --sort=time
164
165 --time-style=STYLE
166 with -l, show times using style STYLE: full-iso, long-iso, iso,
167 locale, or +FORMAT; FORMAT is interpreted like in 'date'; if
168 FORMAT is FORMAT1<newline>FORMAT2, then FORMAT1 applies to
169 non-recent files and FORMAT2 to recent files; if STYLE is pre‐
170 fixed with 'posix-', STYLE takes effect only outside the POSIX
171 locale
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
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 assume screen width instead of current value
187
188 -x list entries by lines instead of by columns
189
190 -X sort alphabetically by entry extension
191
192 -1 list one file per line
193
194 SELinux options:
195
196 --lcontext
197 Display security context. Enable -l. Lines will probably be
198 too wide for most displays.
199
200 -Z, --context
201 Display security context so it fits on most displays. Displays
202 only mode, user, group, security context and file name.
203
204 --scontext
205 Display only security context and file name.
206
207 --help display this help and exit
208
209 --version
210 output version information and exit
211
212 SIZE is an integer and optional unit (example: 10M is 10*1024*1024).
213 Units are K, M, G, T, P, E, Z, Y (powers of 1024) or KB, MB, ... (pow‐
214 ers of 1000).
215
216 Using color to distinguish file types is disabled both by default and
217 with --color=never. With --color=auto, ls emits color codes only when
218 standard output is connected to a terminal. The LS_COLORS environment
219 variable can change the settings. Use the dircolors command to set it.
220
221 Exit status:
222 0 if OK,
223
224 1 if minor problems (e.g., cannot access subdirectory),
225
226 2 if serious trouble (e.g., cannot access command-line argument).
227
228 GNU coreutils online help: <http://www.gnu.org/software/coreutils/>
229 Report dir translation bugs to <http://translationproject.org/team/>
230
232 Written by Richard M. Stallman and David MacKenzie.
233
235 Copyright © 2013 Free Software Foundation, Inc. License GPLv3+: GNU
236 GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
237 This is free software: you are free to change and redistribute it.
238 There is NO WARRANTY, to the extent permitted by law.
239
241 The full documentation for dir is maintained as a Texinfo manual. If
242 the info and dir programs are properly installed at your site, the com‐
243 mand
244
245 info coreutils 'dir invocation'
246
247 should give you access to the complete manual.
248
249
250
251GNU coreutils 8.22 October 2018 DIR(1)