1. 程式人生 > >2.3 ls命令

2.3 ls命令

linux ls命令

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


2.3 ls命令