Linux命令--ls

一、ls命令简介

    命令所在路径:/bin/ls (所有人可以使用)

    命令英文原意:list (清单)

    功能描述:显示目录、文件

    语法:ls+选项+文件或目录

二、ls命令的选项

    1.-a:显示所有文件,包括隐藏文件(“.”“..”)

    2.-A:显示所有文件,但是不包括“.”“..”

    3.-l:已成格式显示(显示详细信息),ls-l+操作对象是单独看对象的详细信息。

    4.-d:显示当前目录名,不显示目录下的内容。(通常和-l连用,格式为ls-ld)。

    5.-h:文件大小显示常见大小单位,B、KB(和-l连用)。

    6.-i:显示文件的inode号,(+操作对象显示指定文件的inode号)

    7.-R:递归处理,显示制定目录和子目录。

    8.-s:显示文件和目录的大小,以区块为单位。

    9.--full-time:列出完整的日期与时间。10.--color[=when]:高亮显示

三、ls命令的实例

[root@localhost ~]# ls

1.txt  2.txt

[root@localhost ~]# ls -a

.  1.txt  .ansible      .bash_logout  .bashrc  .pki  .tcshrc

..  2.txt  .bash_history  .bash_profile  .cshrc  .ssh

[root@localhost ~]# ls -A

1.txt  .ansible      .bash_logout  .bashrc  .pki  .tcshrc

2.txt  .bash_history  .bash_profile  .cshrc  .ssh

[root@localhost ~]# ls -l

total 0

-rw-r--r-- 1 root root 0 Mar  8 08:25 1.txt

-rw-r--r-- 1 root root 0 Mar  8 08:25 2.txt

[root@localhost ~]# ls -ld

dr-xr-x---. 5 root root 178 Mar  8 08:25 .

[root@localhost ~]# ls -lh

total 0

-rw-r--r-- 1 root root 0 Mar  8 08:25 1.txt

-rw-r--r-- 1 root root 0 Mar  8 08:25 2.txt

[root@localhost ~]# ls -R

.:

1.txt  2.txt

[root@localhost ~]# ls -s

total 0

0 1.txt  0 2.txt

[root@localhost ~]# ls --full-time

total 0

-rw-r--r-- 1 root root 0 2018-03-08 08:25:58.915663163 +0800 1.txt

-rw-r--r-- 1 root root 0 2018-03-08 08:25:58.915663163 +0800 2.txt


©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容