LInux學習之常用命令ls,linux常用命令ls

來源:互聯網
上載者:User

LInux學習之常用命令ls,linux常用命令ls

命令格式與目錄處理命令ls

 

命令格式:  命令[-選項][參數]

 

例如:  ls -la /etc

 

說明:

 

1)個別命令使用不遵循此格式

 

2)當多個選項時,可以寫在一起

 

3)簡化選項與完整選項

 

     -a 等於--all

 

PS:在Linux中“.”代表的是隱藏檔案。

 

目錄處理命令:ls

命令名稱: 

 ls

命令英文原意:

list

命令所在路徑:

/bin/ls

執行許可權:

所有使用者

功能描述:

顯示目錄檔案

文法:

ls 選項[-ald][檔案或目錄]

 

-a  顯示所有檔案,包括隱藏檔案

 

-l  詳細資料顯示

 

-d  查看目錄屬性

#ls -a 查看本目錄下的檔案(包含隱藏檔案)

#ls -l 顯示檔案的詳細資料

 

1 root root  1208 12月  3 06:22 anaconda-ks.cfg

 

1 root root 24772 12月  3 06:22 install.log

 

1 root root  7690 12月  3 06:21 install.log.syslog

 

root 所有者  root 所屬組  7690  檔案大小

 

下面的ls -lh是將檔案大小的位元組顯示轉變成我們所熟悉的Windows

 

[root@localhost ~]# ls -lh總用量 44K-rw-------. 1 root root 1.2K 12月  3 06:22 anaconda-ks.cfg-rw-r--r--. 1 root root  25K 12月  3 06:22 install.log-rw-r--r--. 1 root root 7.6K 12月  3 06:21 install.log.syslog

 

1.2K 和 7690代表的是一個意思,只不過當用ls -lh的時候會將檔案大小變成我們所熟悉的K、M、G表示而不是位元組表示。

-rw-r--r--

-檔案類型(-二進位檔案   d表示目錄   l表示軟連結檔案)

 

rw-   r--   r--

 

u     g      o

 

u所有者 g所屬組 o其他人

PS: r讀 w寫 x執行

 

[root@localhost ~]# ls -lhd /etcdrwxr-xr-x. 102 root root 12K 12月 15 06:36 /etc

 

ls -lhd /etc 是查看etc目錄的大小而不是查看ect目錄下的所有內容。

 

[root@localhost ~]# ls -i795111 anaconda-ks.cfg  786436 install.log  786437 install.log.syslog

 

#ls -i 查看每個檔案的id號

 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.