ls命令是Linux系统中最常用的命令之一,它用于列出指定目录中的文件和子目录。
语法:
ls [选项] [文件或目录]
选项:
-a:显示所有文件,包括隐藏文件;
-l:以长格式显示文件属性;
-h:以人性化的方式显示文件大小;
-R:递归显示子目录中的文件;
-r:以相反的顺序显示文件;
-t:按时间排序显示文件;
-S:按文件大小排序显示文件;
-i:显示文件的inode编号;
-F:在文件名后面标注文件类型
例子:
ls 目录1 目录2 …
ls -l -r
ls -l -t -r
ls -R
DESCRIPTION
List information about the FILEs (the current directory by default). Sort entries alphabetically if none of
-cftuvSUX nor --sort is specified.
Mandatory arguments to long options are mandatory for short options too.
-a, --all
do not ignore entries starting with .
-A, --almost-all
do not list implied . and ..
--author
with -l, print the author of each file
-b, --escape
print C-style escapes for nongraphic characters
--block-size=SIZE
scale sizes by SIZE before printing them; e.g., '--block-size=M' prints sizes in units of 1,048,576
bytes; see SIZE format below
-B, --ignore-backups
do not list implied entries ending with ~
......