Skip to content

Commit 34b66a8

Browse files
committed
ls documentation
1 parent 9522cbb commit 34b66a8

File tree

1 file changed

+134
-0
lines changed

1 file changed

+134
-0
lines changed

docs/ls.txt

Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
Usage: ls [OPTION]... [FILE]...
2+
List information about the FILEs (the current directory by default).
3+
Sort entries alphabetically if none of -cftuvSUX nor --sort is specified.
4+
5+
Mandatory arguments to long options are mandatory for short options too.
6+
-a, --all do not ignore entries starting with .
7+
-A, --almost-all do not list implied . and ..
8+
--author with -l, print the author of each file
9+
-b, --escape print C-style escapes for nongraphic characters
10+
--block-size=SIZE with -l, scale sizes by SIZE when printing them;
11+
e.g., '--block-size=M'; see SIZE format below
12+
13+
-B, --ignore-backups do not list implied entries ending with ~
14+
-c with -lt: sort by, and show, ctime (time of last
15+
change of file status information);
16+
with -l: show ctime and sort by name;
17+
otherwise: sort by ctime, newest first
18+
19+
-C list entries by columns
20+
--color[=WHEN] color the output WHEN; more info below
21+
-d, --directory list directories themselves, not their contents
22+
-D, --dired generate output designed for Emacs' dired mode
23+
-f do not sort, enable -aU, disable -ls --color
24+
-F, --classify[=WHEN] append indicator (one of */=>@|) to entries WHEN
25+
--file-type likewise, except do not append '*'
26+
--format=WORD across -x, commas -m, horizontal -x, long -l,
27+
single-column -1, verbose -l, vertical -C
28+
29+
--full-time like -l --time-style=full-iso
30+
-g like -l, but do not list owner
31+
--group-directories-first
32+
group directories before files;
33+
can be augmented with a --sort option, but any
34+
use of --sort=none (-U) disables grouping
35+
36+
-G, --no-group in a long listing, don't print group names
37+
-h, --human-readable with -l and -s, print sizes like 1K 234M 2G etc.
38+
--si likewise, but use powers of 1000 not 1024
39+
-H, --dereference-command-line
40+
follow symbolic links listed on the command line
41+
--dereference-command-line-symlink-to-dir
42+
follow each command line symbolic link
43+
that points to a directory
44+
45+
--hide=PATTERN do not list implied entries matching shell PATTERN
46+
(overridden by -a or -A)
47+
48+
--hyperlink[=WHEN] hyperlink file names WHEN
49+
--indicator-style=WORD
50+
append indicator with style WORD to entry names:
51+
none (default), slash (-p),
52+
file-type (--file-type), classify (-F)
53+
54+
-i, --inode print the index number of each file
55+
-I, --ignore=PATTERN do not list implied entries matching shell PATTERN
56+
-k, --kibibytes default to 1024-byte blocks for file system usage;
57+
used only with -s and per directory totals
58+
59+
-l use a long listing format
60+
-L, --dereference when showing file information for a symbolic
61+
link, show information for the file the link
62+
references rather than for the link itself
63+
64+
-m fill width with a comma separated list of entries
65+
-n, --numeric-uid-gid like -l, but list numeric user and group IDs
66+
-N, --literal print entry names without quoting
67+
-o like -l, but do not list group information
68+
-p, --indicator-style=slash
69+
append / indicator to directories
70+
-q, --hide-control-chars print ? instead of nongraphic characters
71+
--show-control-chars show nongraphic characters as-is (the default,
72+
unless program is 'ls' and output is a terminal)
73+
74+
-Q, --quote-name enclose entry names in double quotes
75+
--quoting-style=WORD use quoting style WORD for entry names:
76+
literal, locale, shell, shell-always,
77+
shell-escape, shell-escape-always, c, escape
78+
(overrides QUOTING_STYLE environment variable)
79+
80+
-r, --reverse reverse order while sorting
81+
-R, --recursive list subdirectories recursively
82+
-s, --size print the allocated size of each file, in blocks
83+
-S sort by file size, largest first
84+
--sort=WORD sort by WORD instead of name: none (-U), size (-S),
85+
time (-t), version (-v), extension (-X), width
86+
87+
--time=WORD select which timestamp used to display or sort;
88+
access time (-u): atime, access, use;
89+
metadata change time (-c): ctime, status;
90+
modified time (default): mtime, modification;
91+
birth time: birth, creation;
92+
with -l, WORD determines which time to show;
93+
with --sort=time, sort by WORD (newest first)
94+
95+
--time-style=TIME_STYLE
96+
time/date format with -l; see TIME_STYLE below
97+
-t sort by time, newest first; see --time
98+
-T, --tabsize=COLS assume tab stops at each COLS instead of 8
99+
-u with -lt: sort by, and show, access time;
100+
with -l: show access time and sort by name;
101+
otherwise: sort by access time, newest first
102+
103+
-U do not sort; list entries in directory order
104+
-v natural sort of (version) numbers within text
105+
-w, --width=COLS set output width to COLS. 0 means no limit
106+
-x list entries by lines instead of by columns
107+
-X sort alphabetically by entry extension
108+
-Z, --context print any security context of each file
109+
--zero end each output line with NUL, not newline
110+
-1 list one file per line
111+
--help display this help and exit
112+
--version output version information and exit
113+
114+
The SIZE argument is an integer and optional unit (example: 10K is 10*1024).
115+
Units are K,M,G,T,P,E,Z,Y,R,Q (powers of 1024) or KB,MB,... (powers of 1000).
116+
Binary prefixes can be used, too: KiB=K, MiB=M, and so on.
117+
118+
The TIME_STYLE argument can be full-iso, long-iso, iso, locale, or +FORMAT.
119+
FORMAT is interpreted like in date(1). If FORMAT is FORMAT1<newline>FORMAT2,
120+
then FORMAT1 applies to non-recent files and FORMAT2 to recent files.
121+
TIME_STYLE prefixed with 'posix-' takes effect only outside the POSIX locale.
122+
Also the TIME_STYLE environment variable sets the default style to use.
123+
124+
The WHEN argument defaults to 'always' and can also be 'auto' or 'never'.
125+
126+
Using color to distinguish file types is disabled both by default and
127+
with --color=never. With --color=auto, ls emits color codes only when
128+
standard output is connected to a terminal. The LS_COLORS environment
129+
variable can change the settings. Use the dircolors(1) command to set it.
130+
131+
Exit status:
132+
0 if OK,
133+
1 if minor problems (e.g., cannot access subdirectory),
134+
2 if serious trouble (e.g., cannot access command-line argument).

0 commit comments

Comments
 (0)