命令

ls 命令

使用及参数

 ls [-alrtAFR] [name...]
-a 显示所有文件及目录 (ls内定将文件名或目录名称开头为"."的视为隐藏档,不会列出)
-l 除文件名称外,亦将文件型态、权限、拥有者、文件大小等资讯详细列出
-r 将文件以相反次序显示(原定依英文字母次序)
-t 将文件依建立时间之先后次序列出
-A 同 -a ,但不列出 "." (目前目录) 及 ".." (父目录)
-F 在列出的文件名称后加一符号;例如可执行档则加 "*", 目录则加 "/"
-R 若目录下有文件,则以下之文件亦皆依序列出
[chenxi188@centos-7 ~]$ pwd
/home/chenxi188
[chenxi188@centos-7 ~]$ ls -a
.              .bash_profile  .dbus      .esd_auth      Pictures
..             .bashrc        Desktop    .ICEauthority  Public
.bash_history  .cache         Documents  .local         Templates
.bash_logout   .config        Downloads  Music          Videos
[chenxi188@centos-7 ~]$ ls -l
总用量 0
drwxr-xr-x. 2 chenxi188 chenxi188 6 3月  26 16:13 Desktop
drwxr-xr-x. 2 chenxi188 chenxi188 6 3月  26 2020 Documents
drwxr-xr-x. 2 chenxi188 chenxi188 6 3月  26 2020 Downloads
drwxr-xr-x. 2 chenxi188 chenxi188 6 3月  26 2020 Music
drwxr-xr-x. 2 chenxi188 chenxi188 6 3月  26 2020 Pictures
drwxr-xr-x. 2 chenxi188 chenxi188 6 3月  26 2020 Public
drwxr-xr-x. 2 chenxi188 chenxi188 6 3月  26 2020 Templates
drwxr-xr-x. 2 chenxi188 chenxi188 6 3月  26 2020 Videos
[chenxi188@centos-7 ~]$ ls -la
总用量 36
drwx------. 14 chenxi188 chenxi188 4096 3月  26 16:20 .
drwxr-xr-x.  3 root      root        23 3月  26 2020 ..
-rw-------.  1 chenxi188 chenxi188  371 3月  26 16:17 .bash_history
-rw-r--r--.  1 chenxi188 chenxi188   18 8月   8 2019 .bash_logout
-rw-r--r--.  1 chenxi188 chenxi188  193 8月   8 2019 .bash_profile
-rw-r--r--.  1 chenxi188 chenxi188  231 8月   8 2019 .bashrc
drwx------. 18 chenxi188 chenxi188 4096 3月  26 15:58 .cache
drwxr-xr-x. 17 chenxi188 chenxi188 4096 3月  26 15:58 .config
drwx------.  3 chenxi188 chenxi188   25 3月  26 2020 .dbus
drwxr-xr-x.  2 chenxi188 chenxi188    6 3月  26 16:13 Desktop
drwxr-xr-x.  2 chenxi188 chenxi188    6 3月  26 2020 Documents
drwxr-xr-x.  2 chenxi188 chenxi188    6 3月  26 2020 Downloads
-rw-------.  1 chenxi188 chenxi188   16 3月  26 2020 .esd_auth
-rw-------.  1 chenxi188 chenxi188  930 3月  26 16:20 .ICEauthority
drwx------.  3 chenxi188 chenxi188   19 3月  26 2020 .local
drwxr-xr-x.  2 chenxi188 chenxi188    6 3月  26 2020 Music
drwxr-xr-x.  2 chenxi188 chenxi188    6 3月  26 2020 Pictures
drwxr-xr-x.  2 chenxi188 chenxi188    6 3月  26 2020 Public
drwxr-xr-x.  2 chenxi188 chenxi188    6 3月  26 2020 Templates
drwxr-xr-x.  2 chenxi188 chenxi188    6 3月  26 2020 Videos

[chenxi188@centos-7 ~]$ ls -ld
drwx------. 14 chenxi188 chenxi188 4096 3月  26 16:20 .


$ ls -la /home
总用量 4
drwxr-xr-x.  3 root      root        23 3月  26 2020 .
dr-xr-xr-x. 17 root      root       224 3月  26 2020 ..
drwx------. 14 chenxi188 chenxi188 4096 3月  26 16:20 chenxi188

蓝色—目录
绿色—可执行文件
红色—压缩文件
浅蓝色—链接文件
粉红色—图片文件
黄色—设备文件
灰色—其他文件

posted @ 2020-03-26 16:41  晨光曦微  阅读(102)  评论(0编辑  收藏  举报