**
*linux学习笔记-ls命令
ls -l ##ls -list directory contents(列出目录的内容) -l use a long listing format(使用一个长的列出格式)
在根目录下输入ls -l命令或ll
如上图:总共有七列
- 第一列:用于标识文件的属性。总共有10个字符。
第一个字符:标识文件的类型。d - 是目录 l - 是链接文档(link file) b - 装置文件里面的可供储存的接口设备 c - 装置文件里面的串行端口设备,例如键盘、鼠标( ‘-’ - 是普通文件
r - 表示 read读权限,w - 表示write写权限 x - 表示 execute可执行权限
其余9个字符按顺序前三个对应owner(拥有人)中间三个对应group(拥有组)最后三个对应others(其他)
例如下:l是链接文件,拥有人的权限是rwx,拥有组的权限是rwx,其他人的权限是rwx。
-
第二列是 硬链接的次数
-
第三列是拥有人,第四列是拥有组
-
第五列是文件大小 使用ls -h,更可读
-
第六列是最后一次修改的时间
-
第七列是文件字符串名
ls用法
ls -
-a, a的解释 --all -do not ignore entries starting with .不忽略以"."字符开始的文件
-
-A, A的解释–almost-all do not list implied . and …除了不列出‘.’和’…'其他的文件全列出
-
–author print the author of each file 打印每一个文件的作者
-
-b, --escape print C-style escapes for nongraphic characters打印无图形字符c-样式转义
-
-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 和lt拼接是根据文件状态信息最后一次的修改时间排序并显示时间;和l拼接显示时间根据名字排序
-
-C list entries by columns 按列列出条目(文件或目录文件)
-
-d, --directory list directories themselves, not their contents列出目录本身“.”,而不是他们的内容.
-
-f do not sort, enable -aU, disable -ls --color
-
-F, --classify append indicator (one of */=>@|) to entries 添加标识
-
–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 功能与l相似,不同以完整的时间输出
-
-g like -l, but do not list owner 与l类似,但不列出拥有人
-
–group-directories-first 按列分组
-
–G no group 不分组
-
-h, --human-readable with -l, print sizes in human readable format (e.g., 1K 234M 2G) 和l拼接,给文件大小加单位
-
-m fill width with a comma separated list of entries 把条目以逗号隔开
-
-n, --numeric-uid-gid like -l, but list numeric user and group IDs
-
-R, --recursive list subdirectories recursively 递归的列出子目录
-
-s, --size print the allocated size of each file, in blocks 打印在块中为每一个文件分配的大小
-
-s, --size print the allocated size of each file, in blocks
-
–sort=WORD
sort by WORD instead of name: none (-U), size (-S), time (-t), version (-v), extension (-X) 排序