ls list directory contents 列出目录 也可以是文件
参数
-a =all 列出所有文件,包括隐藏文件,示例
[root@bob ~]# ls
anaconda-ks.cfg ett.txt install.log install.log.syslog
[root@bob ~]# ls -a
. anaconda-ks.cfg .bash_logout .bashrc ett.txt install.log.syslog .viminfo
.. .bash_history .bash_profile .cshrc install.log .tcshrc
在linux中以.开头的文件为隐藏文件,其中.代表当前目录,..代表上一层目录。
-l 以长格式列出文件列表输出内容,示例
[root@bob ~]# ls -l
total 48
-rw-------. 1 root root 1252 Dec 18 19:10 anaconda-ks.cfg
-rw-r--r--. 1 root root 6 Dec 19 06:35 ett.txt
-rw-r--r--. 1 root root 27312 Dec 18 19:10 install.log
-rw-r--r--. 1 root root 7572 Dec 18 19:09 install.log.syslog
-t 以文件的修改时间排序
[root@bob ~]# ls -tl
total 48
-rw-r--r--. 1 root root 6 Dec 19 06:35 ett.txt
-rw-------. 1 root root 1252 Dec 18 19:10 anaconda-ks.cfg
-rw-r--r--. 1 root root 27312 Dec 18 19:10 install.log
-rw-r--r--. 1 root root 7572 Dec 18 19:09 install.log.syslog
-d 仅显示目录
-s 显示文件的大小已区块显示
[root@bob ~]# ls -s
total 48
4 anaconda-ks.cfg 4 ett.txt 32 install.log 8 install.log.syslog
--color[=WHEN] 使用不同颜色显示不同类型的文件
差不多就写到这里,,有空在总结