Skip to content

Commit 1f6fa07

Browse files
authored
Update ls.md
1 parent d84abab commit 1f6fa07

1 file changed

Lines changed: 99 additions & 22 deletions

File tree

‎command/ls.md‎

Lines changed: 99 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -16,28 +16,105 @@ ls(选项)(参数)
1616
### 选项
1717

1818
```
19-
-a:显示所有档案及目录(ls内定将档案名或目录名称为“.”的视为隐藏,不会列出);
20-
-A:显示除隐藏文件“.”和“..”以外的所有文件列表;
21-
-C:多列显示输出结果。这是默认选项;
22-
-l:与“-C”选项功能相反,所有输出信息用单列格式输出,不输出为多列;
23-
-F:在每个输出项后追加文件的类型标识符,具体含义:“*”表示具有可执行权限的普通文件,“/”表示目录,“@”表示符号链接,“|”表示命令管道FIFO,“=”表示sockets套接字。当文件为普通文件时,不输出任何标识符;
24-
-b:将文件中的不可输出的字符以反斜线“”加字符编码的方式输出;
25-
-c:与“-lt”选项连用时,按照文件状态时间排序输出目录内容,排序的依据是文件的索引节点中的ctime字段。与“-l”选项连用时,则排序的一句是文件的状态改变时间;
26-
-d:仅显示目录名,而不显示目录下的内容列表。显示符号链接文件本身,而不显示其所指向的目录列表;
27-
-f:此参数的效果和同时指定“aU”参数相同,并关闭“lst”参数的效果;
28-
-i:显示文件索引节点号(inode)。一个索引节点代表一个文件;
29-
--file-type:与“-F”选项的功能相同,但是不显示“*”;
30-
-k:以KB(千字节)为单位显示文件大小;
31-
-l:以长格式显示目录下的内容列表。输出的信息从左到右依次包括文件名,文件类型、权限模式、硬连接数、所有者、组、文件大小和文件的最后修改时间等;
32-
-m:用“,”号区隔每个文件和目录的名称;
33-
-n:以用户识别码和群组识别码替代其名称;
34-
-r:以文件名反序排列并输出目录内容列表;
35-
-s:显示文件和目录的大小,以区块为单位;
36-
-t:用文件和目录的更改时间排序;
37-
-L:如果遇到性质为符号链接的文件或目录,直接列出该链接所指向的原始文件或目录;
38-
-R:递归处理,将指定目录下的所有文件及子目录一并处理;
39-
--full-time:列出完整的日期与时间;
40-
--color[=WHEN]:使用不同的颜色高亮显示不同类型的。
19+
20+
-a, --all 不隐藏任何以. 开始的项目
21+
-A, --almost-all 列出除. 及.. 以外的任何项目
22+
--author 与-l 同时使用时列出每个文件的作者
23+
-b, --escape 以八进制溢出序列表示不可打印的字符
24+
--block-size=SIZE scale sizes by SIZE before printing them; e.g.,
25+
'--block-size=M' prints sizes in units of
26+
1,048,576 bytes; see SIZE format below
27+
-B, --ignore-backups do not list implied entries ending with ~
28+
-c with -lt: sort by, and show, ctime (time of last
29+
modification of file status information);
30+
with -l: show ctime and sort by name;
31+
otherwise: sort by ctime, newest first
32+
-C list entries by columns
33+
--color[=WHEN] colorize the output; WHEN can be 'never', 'auto',
34+
or 'always' (the default); more info below
35+
-d, --directory list directories themselves, not their contents
36+
-D, --dired generate output designed for Emacs' dired mode
37+
-f do not sort, enable -aU, disable -ls --color
38+
-F, --classify append indicator (one of */=>@|) to entries
39+
--file-type likewise, except do not append '*'
40+
--format=WORD across -x, commas -m, horizontal -x, long -l,
41+
single-column -1, verbose -l, vertical -C
42+
--full-time like -l --time-style=full-iso
43+
-g 类似-l,但不列出所有者
44+
--group-directories-first
45+
group directories before files;
46+
can be augmented with a --sort option, but any
47+
use of --sort=none (-U) disables grouping
48+
-G, --no-group 以一个长列表的形式,不输出组名
49+
-h, --human-readable 与-l 一起,以易于阅读的格式输出文件大小
50+
(例如 1K 234M 2G)
51+
--si 同上面类似,但是使用1000 为基底而非1024
52+
-H, --dereference-command-line
53+
follow symbolic links listed on the command line
54+
--dereference-command-line-symlink-to-dir
55+
follow each command line symbolic link
56+
that points to a directory
57+
--hide=PATTERN do not list implied entries matching shell PATTERN
58+
(overridden by -a or -A)
59+
--indicator-style=WORD append indicator with style WORD to entry names:
60+
none (default), slash (-p),
61+
file-type (--file-type), classify (-F)
62+
-i, --inode print the index number of each file
63+
-I, --ignore=PATTERN do not list implied entries matching shell PATTERN
64+
-k, --kibibytes default to 1024-byte blocks for disk usage
65+
-l 使用较长格式列出信息
66+
-L, --dereference 当显示符号链接的文件信息时,显示符号链接所指示
67+
的对象而并非符号链接本身的信息
68+
-m 所有项目以逗号分隔,并填满整行行宽
69+
-n, --numeric-uid-gid 类似 -l,但列出UID 及GID 号
70+
-N, --literal 输出未经处理的项目名称 (如不特别处理控制字符)
71+
-o 类似 -l,但不列出有关组的信息
72+
-p, --indicator-style=slash 对目录加上表示符号"/"
73+
-q, --hide-control-chars print ? instead of nongraphic characters
74+
--show-control-chars show nongraphic characters as-is (the default,
75+
unless program is 'ls' and output is a terminal)
76+
-Q, --quote-name enclose entry names in double quotes
77+
--quoting-style=WORD use quoting style WORD for entry names:
78+
literal, locale, shell, shell-always, c, escape
79+
-r, --reverse 逆序排列
80+
-R, --recursive 递归显示子目录
81+
-s, --size 以块数形式显示每个文件分配的尺寸
82+
-S sort by file size
83+
--sort=WORD sort by WORD instead of name: none (-U), size (-S),
84+
time (-t), version (-v), extension (-X)
85+
--time=WORD with -l, show time as WORD instead of default
86+
modification time: atime or access or use (-u)
87+
ctime or status (-c); also use specified time
88+
as sort key if --sort=time
89+
--time-style=STYLE with -l, show times using style STYLE:
90+
full-iso, long-iso, iso, locale, or +FORMAT;
91+
FORMAT is interpreted like in 'date'; if FORMAT
92+
is FORMAT1<newline>FORMAT2, then FORMAT1 applies
93+
to non-recent files and FORMAT2 to recent files;
94+
if STYLE is prefixed with 'posix-', STYLE
95+
takes effect only outside the POSIX locale
96+
-t sort by modification time, newest first
97+
-T, --tabsize=COLS assume tab stops at each COLS instead of 8
98+
-u with -lt: sort by, and show, access time;
99+
with -l: show access time and sort by name;
100+
otherwise: sort by access time
101+
-U do not sort; list entries in directory order
102+
-v natural sort of (version) numbers within text
103+
-w, --width=COLS assume screen width instead of current value
104+
-x list entries by lines instead of by columns
105+
-X sort alphabetically by entry extension
106+
-1 list one file per line
107+
108+
SELinux options:
109+
110+
--lcontext Display security context. Enable -l. Lines
111+
will probably be too wide for most displays.
112+
-Z, --context Display security context so it fits on most
113+
displays. Displays only mode, user, group,
114+
security context and file name.
115+
--scontext Display only security context and file name.
116+
--help 显示此帮助信息并退出
117+
--version 显示版本信息并退出
41118
```
42119

43120
### 参数

0 commit comments

Comments
 (0)