ls 用来显示目标列表,使用率比较高的一个命令,有很多常用选项;
ls -l;列出详细信息
总用量 4
-rw-------. 1 root root 1548 6月 3 01:11 anaconda-ks.cfg
第1列;权限
第2列;inode,有多少个文件使用了相同的inode;
第3列;文件所有者
第4列;所属组
第5列;文件的大小
第6列;文件创建的时间
第7列;文件名
ls -i;查看inode;
[root@shuxin ~]# ls -i
33580930 anaconda-ks.cfg
inode;存储文件的权限,所属者,时间、大小,记录文件存在磁盘的哪一个块哪一个区域,如果两个文件使用了相同的inode,意味着这两个文件所存放的数据块位置是唯一的,一样的。
ls -lh 人性化显示;
[root@shuxin ~]# ls -lh //显示文件大小为kb
总用量 4.0K
-rw-------. 1 root root 1.6K 6月 3 01:11 anaconda-ks.cfg
ls -a 显示隐藏文件;
[root@shuxin ~]# ls -a //显示隐藏文件或目录“.”意思为隐藏目录
. anaconda-ks.cfg .bash_logout .bashrc .ssh
.. .bash_history .bash_profile .cshrc .tcshrc
ls -la列出详细隐藏文件;//选项是可以一起使用的
[root@shuxin ~]# ls -la
总用量 28
dr-xr-x---. 3 root root 147 6月 3 06:14 .//表示root目录
dr-xr-xr-x. 17 root root 224 6月 3 01:09 ..
-rw-------. 1 root root 1548 6月 3 01:11 anaconda-ks.cfg
-rw-------. 1 root root 2268 6月 3 18:56 .bash_history
-rw-r--r--. 1 root root 18 12月 29 2013 .bash_logout
-rw-r--r--. 1 root root 176 12月 29 2013 .bash_profile
-rw-r--r--. 1 root root 176 12月 29 2013 .bashrc
-rw-r--r--. 1 root root 100 12月 29 2013 .cshrc
drwx------. 2 root root 25 6月 3 06:14 .ssh
-rw-r--r--. 1 root root 129 12月 29 2013 .tcshrc
ls -ld显示文件夹信息
[root@shuxin ~]# ls -ld /root/
dr-xr-x---. 3 root root 147 6月 3 06:14 /root/ //有三个目录inode号相同
ls -lta //t以时间最新到最旧的方法排序
[root@shuxin ~]# ls -lta
总用量 28
-rw-------. 1 root root 2268 6月 3 18:56 .bash_history
drwx------. 2 root root 25 6月 3 06:14 .ssh
dr-xr-x---. 3 root root 147 6月 3 06:14 .
-rw-------. 1 root root 1548 6月 3 01:11 anaconda-ks.cfg
dr-xr-xr-x. 17 root root 224 6月 3 01:09 ..
ls -d 列目录本身;
# ls -d /root/
/root/
ll为ls -l的简写,列出详细列表;
# which ll //可以通过which来查看ll
alias ll='ls -l --color=auto'//color为颜色
/usr/bin/ls //命令调用于哪个目录
实验;
# ll
总用量 4
-rw-------. 1 root root 1548 6月 3 01:11 anaconda-ks.cfg