across -x, commas -m, horizontal -x, long -l, single-column -1, verbose -l, vertical -C
–full-time
tong -l --time-style=full-iso
-g
同-l, 不列出所有者
–group-directories-first
group directories before files
-G,–no-group
不列出组名
-h, –human-readable
显示人性化的文件大小
–si
使用1000代替 1024
-H, –dereference-command-line
跟随符号链接
–dereference-command-line-symlink-to-dir
跟随指向目录的符号链接
–hide=PATTEN
不显示匹配模式的文件(被-A,-a覆盖)
–hyperlink[=when]
hyperlink file names; WHEN can be ‘always’ (默认值), ‘auto’, or ‘never’
–indicator-style=WORD
append indicator with style WORD to entry names: none (default), slash (-p), file-type (–file-type), classify (-F)
-i , –inode
显示文件的inode号
-I, –ignore=PATTERN
不显示模式匹配的项
-k, –kibibytes
default to 1024-byte blocks for disk usage; used only with -s and per directory totals
-l
使用长格式
-L, –dereference
跟随符号链接,而不是本身
-m
用,作为分隔符
-n, –numeric-uid-gid
同-l,但是列出 uid、gid
-N, –literal
名字加上引号
-o
同-l, 但是不显示组信息
-p, –indicator-style= slash
append / indicator to directories
-q, –hide-control-chars
print ? instead of nongraphic characters
–show-control-chars
show nongraphic characters as-is (the default, unless program is ‘ls’ and output is a terminal)
-Q, –quto-name
用双引号引起文件名,非打印字符以 C 语言的方法表示
–quoting-style=WORD
use quoting style WORD for entry names: literal, locale, shell, shell-always, shell-escape, shell-escape-always, c, escape (overrides QUOTING_STYLE environment variable)
-r, –reverse
排序翻转
-R, –rscusive
递归子目录
-s, –size
显示分配给文件的尺寸(in blocks)
-S
以文件尺寸进行排序,大文件在前
–sort=word
sort by WORD instead of name: none (-U), size (-S), time (-t), version (-v), extension (-X)
–time=word
with -l, show time as WORD instead of default modification time: atime or access or use (-u); ctime or status (-c); also use specified time as sort key if –sort=time (newest first)
–time-style=TIME_STYLE
time/date format with -l; see TIME_STYLE below
-t
以文件修改时间排序,最新的文件在前
-T, –tabsize=COLS
assume tab stops at each COLS instead of 8
-u
with -lt: sort by, and show, access time; with -l: show access time and sort by name; otherwise: sort by access time, newest first
-U
不排序
-v
natural sort of (version) numbers within text
-w, –width=COLS
set output width to COLS. 0 means no limit
-x
list entries by lines instead of by columns
-X
sort alphabetically by entry extension
-Z, –context
print any security context of each file
-1
list one file per line. Avoid ‘\n’ with -q or -b
–help
display this help and exit
–version
output version information and exit
The SIZE argument is an integer and optional unit (example: 10K is 10*1024). Units are K,M,G,T,P,E,Z,Y (powers of 1024) or KB,MB,… (powers of 1000). Binary prefixes can be used, too: KiB=K, MiB=M, and so on.
The TIME_STYLE argument can be full-iso, long-iso, iso, locale, or +FORMAT. FORMAT is interpreted like in date(1). If FORMAT is FORMAT1FORMAT2, then FORMAT1 applies to non-recent files and FORMAT2 to recent files. TIME_STYLE prefixed with ‘posix-‘ takes effect only outside the POSIX locale. Also the TIME_STYLE environment variable sets the default style to use.
Using color to distinguish file types is disabled both by default and with –color=never. With –color=auto, ls emits color codes only when standard output is connected to a terminal. The LS_COLORS environment variable can change the settings. Use the dircolors command to set it.
退出
0 成功
1 出现小问题(如无法访问子目录)
2 出现严重问题(如无法访问命令行参数)
实例
1 2 3 4
$ ls# 仅列出当前目录可见文件 $ ls -l # 列出当前目录可见文件详细信息 $ ls -hl # 列出详细信息并以可读大小显示文件大小 $ ls -al # 列出所有文件(包括隐藏)的详细信息