您的位置:首页 > 运维架构 > Linux

【每天一个Linux命令】21. 列出目录内容命令ls

2013-10-08 12:56 1251 查看
ls帮助文件

bixiaopeng@bixiaopeng-To-be-filled-by-O-E-M:$ ls --help
用法:ls [选项]... [文件]...
List information about the FILEs (the current directory by default).
Sort entries alphabetically if none of -cftuvSUX nor --sort is specified.
长选项必须使用的参数对于短选项时也是必需使用的。
-a, --all 不隐藏任何以. 开始的项目
-A, --almost-all 列出除. 及.. 以外的任何项目
--author 与-l 同时使用时列出每个文件的作者
-b, --escape 以八进制溢出序列表示不可打印的字符
--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 ~
-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
-C list entries by columns
--color[=WHEN] colorize the output. WHEN defaults to 'always'
or can be 'never' or 'auto'. More info below
-d, --directory list directory entries instead of contents,
and do not dereference symbolic links
-D, --dired generate output designed for Emacs' dired mode
-f do not sort, enable -aU, disable -ls --color
-F, --classify append indicator (one of */=>@|) to entries
--file-type likewise, except do not append '*'
--format=WORD across -x, commas -m, horizontal -x, long -l,
single-column -1, verbose -l, vertical -C
--full-time like -l --time-style=full-iso
-g 类似-l,但不列出所有者
--group-directories-first
在文件前分组目录。此选项可与--sort 一起使用,
但是一旦使用--sort=none (-U)将禁用分组
-G, --no-group 以一个长列表的形式,不输出组名
-h, --human-readable 与-l 一起,以易于阅读的格式输出文件大小
(例如 1K 234M 2G)
--si 同上面类似,但是使用1000 为基底而非1024
-H, --dereference-command-line
跟随命令行列出的符号链接
--dereference-command-line-symlink-to-dir
跟随命令行列出的目录的符号链接
--hide=PATTERN 隐藏符合PATTERN 模式的项目
(-a 或 -A 将覆盖此选项)
--indicator-style=WORD append indicator with style WORD to entry names:
none (default), slash (-p),
file-type (--file-type), classify (-F)
-i, --inode print the index number of each file
-I, --ignore=PATTERN do not list implied entries matching shell PATTERN
-k, --kibibytes use 1024-byte blocks
-l 使用较长格式列出信息
-L, --dereference 当显示符号链接的文件信息时,显示符号链接所指示
的对象而并非符号链接本身的信息
-m 所有项目以逗号分隔,并填满整行行宽
-n, --numeric-uid-gid 类似 -l,但列出UID 及GID 号
-N, --literal 输出未经处理的项目名称 (如不特别处理控制字符)
-o 类似 -l,但不列出有关组的信息
-p, --indicator-style=slash 对目录加上表示符号"/"
-q, --hide-control-chars print ? instead of non graphic characters
--show-control-chars show non graphic characters as-is (default
unless program is 'ls' and output is a terminal)
-Q, --quote-name enclose entry names in double quotes
--quoting-style=WORD use quoting style WORD for entry names:
literal, locale, shell, shell-always, c, escape
-r, --reverse 逆序排列
-R, --recursive 递归显示子目录
-s, --size 以块数形式显示每个文件分配的尺寸
-S 根据文件大小排序
--sort=WORD 以下是可选用的WORD 和它们代表的相应选项:
extension -X status -c
none -U time -t
size -S atime -u
time -t access -u
version -v use -u
--time=WORD 和-l 同时使用时显示WORD 所代表的时间而非修改时
间:atime、access、use、ctime 或status;加上
--sort=time 选项时会以指定时间作为排序关键字
--time-style=STYLE with -l, show times using style STYLE:
full-iso, long-iso, iso, locale, +FORMAT.
FORMAT is interpreted like 'date'; if FORMAT is
FORMAT1<newline>FORMAT2, FORMAT1 applies to
non-recent files and FORMAT2 to recent files;
if STYLE is prefixed with 'posix-', STYLE
takes effect only outside the POSIX locale
-t sort by modification time, newest first
-T, --tabsize=COLS assume tab stops at each COLS instead of 8
-u 同-lt 一起使用:按照访问时间排序并显示
同-l一起使用:显示访问时间并按文件名排序
其他:按照访问时间排序
-U 不进行排序;按照目录顺序列出项目
-v 在文本中进行数字(版本)的自然排序
-w, --width=COLS 自行指定萤幕宽度而不使用目前的数值
-x 逐行列出项目而不是逐栏列出
-X 根据扩展名排序
-1 每行只列出一个文件
--help 显示此帮助信息并退出
--version 显示版本信息并退出



举个例子

列出当前文件夹下的所有文件和目录的详细资料

bixiaopeng@bixiaopeng-To-be-filled-by-O-E-M:~/workspace2/xmrobotium$ ls -lR
.:
总用量 44
-rw-rw-r-- 1 bixiaopeng bixiaopeng 575 9月 17 19:00 AndroidManifest.xml
drwxrwxr-x 3 bixiaopeng bixiaopeng 4096 9月 17 19:00 bin
-rw-rw-r-- 1 bixiaopeng bixiaopeng 1268 9月 17 19:00 debug.keystore
drwxrwxr-x 3 bixiaopeng bixiaopeng 4096 9月 17 19:00 gen
-rw-rw-r-- 1 bixiaopeng bixiaopeng 3571 9月 17 19:00 pom.xml
-rw-rw-r-- 1 bixiaopeng bixiaopeng 781 9月 17 19:00 proguard-project.txt
-rw-rw-r-- 1 bixiaopeng bixiaopeng 563 9月 17 19:00 project.properties
-rw-rw-r-- 1 bixiaopeng bixiaopeng 0 9月 17 18:57 README
drwxrwxr-x 7 bixiaopeng bixiaopeng 4096 9月 17 19:00 res
drwxrwxr-x 3 bixiaopeng bixiaopeng 4096 9月 17 19:00 src
drwxrwxr-x 6 bixiaopeng bixiaopeng 4096 9月 17 19:00 target
-rw-rw-r-- 1 bixiaopeng bixiaopeng 2295 9月 17 19:11 xmrobotium.iml
./bin:
总用量 8
-rw-rw-r-- 1 bixiaopeng bixiaopeng 575 9月 17 19:00 AndroidManifest.xml
drwxrwxr-x 3 bixiaopeng bixiaopeng 4096 9月 17 19:00 classes
./bin/classes:
总用量 4
drwxrwxr-x 3 bixiaopeng bixiaopeng 4096 9月 17 19:00 fm
./bin/classes/fm:
总用量 4
drwxrwxr-x 3 bixiaopeng bixiaopeng 4096 9月 17 19:00 xiami
./bin/classes/fm/xiami:
总用量 4
drwxrwxr-x 3 bixiaopeng bixiaopeng 4096 9月 17 19:00 main
./bin/classes/fm/xiami/main:
总用量 4
drwxrwxr-x 2 bixiaopeng bixiaopeng 4096 9月 17 19:00 test
./bin/classes/fm/xiami/main/test:
...........................
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: