天天看點

ls指令

LS=list  (清單)

→ls   (列出目前目錄下所有的檔案和目錄,後面也可以跟目錄的名字)

→ls -l(顯示目錄或檔案的詳細資訊)

[root@qiangge ~]# ls -l

總用量 24

-rw-------. 1 root root   943 12月 17 05:17 anaconda-ks.cfg

-rw-r--r--. 1 root root 12360 12月 17 05:17 install.log

-rw-r--r--. 1 root root  3482 12月 17 05:16 install.log.syslog

http://blog.csdn.net/haiross/article/details/39157885     了解 inode

ls指令

→ls -lh (+h很合理的顯示檔案大小,用最适合的機關顯示)

[root@localhost ~]# ls -lh anaconda-ks.cfg

-rw-------. 1 root root 1.6K 5月  28 21:27 anaconda-ks.cfg

→ls -a(檢視隐藏的檔案)--{檔案前面有個點,就表示檔案是隐藏的}

[root@qiangge ~]# ls -a

.       anaconda-ks.cfg  .bash_profile  install.log

..      .bash_history    .bashrc        install.log.syslog

.1.txt  .bash_logout     .cshrc         .tcshrc

→touch(建立檔案){可以直接建立隐藏的檔案,例:touch .1.txt}

[root@qiangge ~]# touch .1.txt

→ls -d(隻檢視目前目錄 ){ls -ld可以檢視目錄本身的詳細資訊}

[root@qiangge ~]# ls -ld

dr-xr-x---. 2 root root 4096 12月 18 06:19 .

→ls -t(檢視目前目錄下或者指定目錄下的檔案按時間排序)

[root@qiangge ~]# ls -lt

→ls -lta ./(列出目前目錄下所有目錄和檔案的詳細資訊,按時間排序顯示)

[root@qiangge ~]# ls -lta ./

總用量 56

-rw-r--r--.  1 root root     0 12月 18 06:25 .1.txt

dr-xr-x---.  2 root root  4096 12月 18 06:19 .

dr-xr-xr-x. 21 root root  4096 12月 18 06:14 ..

-rw-------.  1 root root   779 12月 17 18:56 .bash_history

-rw-------.  1 root root   943 12月 17 05:17 anaconda-ks.cfg

-rw-r--r--.  1 root root 12360 12月 17 05:17 install.log

-rw-r--r--.  1 root root  3482 12月 17 05:16 install.log.syslog

-rw-r--r--.  1 root root    18 5月  20 2009 .bash_logout

-rw-r--r--.  1 root root   176 5月  20 2009 .bash_profile

-rw-r--r--.  1 root root   129 12月  4 2004 .tcshrc

-rw-r--r--.  1 root root   176 9月  23 2004 .bashrc

-rw-r--r--.  1 root root   100 9月  23 2004 .cshrc

→ls -i(可以檢視檔案或目錄的inode号) {inode記錄檔案或目錄的屬性資訊的}

  每一個檔案都對應一個唯一的inode号,(數字)

[root@qiangge ~]# ls -i

783726 anaconda-ks.cfg  783364 install.log.syslog

783363 install.log

[root@qiangge ~]# ls -li

783726 -rw-------. 1 root root   943 12月 17 05:17 anaconda-ks.cfg

783363 -rw-r--r--. 1 root root 12360 12月 17 05:17 install.log

上一篇: ls 指令
下一篇: ls指令

繼續閱讀