命令格式:
ls [OPTION]... [FILE]...
OPTION:
-a # 列出目录下所有的内容,包括隐藏文件
--author # with -l, 可以显示创建文件的原始属主和属组
-l # 以长格式列出详细信息
-h # with -l, print sizes in human readable format (e.g., 1K 234M 2G)
--si # likewise, but use powers of 1000 not 1024
-d # 列出指定目录的目录信息
--full-time # 时间信息详细显示,例如:2019-04-19 22:21:36.152269504 -0400
-i # print the index number of each file
-n # 长格式显示信息时,属主和属组以 uid 和 gid 的形式显示
-L #当显示符号链接的文件信息时,显示链接引用而不是链接本身的文件信息
-p # 在目录后面追加 /
-r # 倒序
-R # 递归列出子目录
-s # 以块为单位打印每个文件的分配大小
-S # sort by file size
-U # 不排序;按文件被创建顺序列出条目
-v # 文本中(版本)数字的自然排序
-X # 按条目扩展名按字母顺序排序
--sort=WORD # sort by WORD instead of name: none (-U), size (-S), time (-t),
# version (-v), extension (-X)
--time={ctime|atime} # 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
-u # with -lt: sort by, and show, access time; with -l: show access time
# and sort by name; otherwise: sort by access time
-c # with -lt: sort by, and show, ctime (time of last modification of
# file status information); with -l: show ctime and sort by name;
# otherwise: sort by ctime, newest first
-t # sort by modification time, newest first
--time-style={long-iso|iso|+FORMAT} # +FORMAT 的格式和 date 中的一样
-I # 不列出与 shell PATTERN 匹配的隐含
--file-type # 目录后追加 / ,软链接追加 @ ,套接字文件追加 = ,
# 可执行文件追加 * ,重定向文件追加 > ,管道文件追加 |
--color[=WHEN] # colorize the output; WHEN can be 'never', 'auto', or
# 'always' (the default); more info below
--block-size=SIZE # 使用指定的块大小显示容量
-1 # 一行列出一个条目
需要注意:
ls 长格式显示的时间默认为修改时间