技術(shù)員聯(lián)盟提供win764位系統(tǒng)下載,win10,win7,xp,裝機純凈版,64位旗艦版,綠色軟件,免費軟件下載基地!

當(dāng)前位置:主頁 > 教程 > 服務(wù)器類 >

CentOS中文件夾基本操作命令的講解

來源:技術(shù)員聯(lián)盟┆發(fā)布時間:2017-04-26 03:36┆點擊:

-l---以長格式(內(nèi)容更詳細)顯示文件或目錄的詳細信息,。

l代表符號鏈接, 說明:ls -l命令可以簡寫成ll,藍色代表目錄,c代表字符設(shè)備,以byte為單位 1 [root@localhost local]# du -b src/nagios-3.5.0.tar.gz 2 1789376 src/nagios-3.5.0.tar.gz 3 [root@localhost local]# -c或--total---顯示每個目錄或文件的大小外, 輸出的信息共分為7組: 文件類別和文件權(quán)限、鏈接數(shù)或子目錄個數(shù)、文件所有者、文件所屬組、文件大小(單位為字節(jié)B)、文件創(chuàng)建或修改時間、文件名,也將檔案依序列出 1 [root@localhost ~]# ls -lR /home 2 /home: 3 總用量 20 4 drwx------. 27 justin justin 4096 9月 22 13:19 justin 5 drwx------. 2 root root 16384 9月 18 15:30 lost+found 6 /home/justin: 7 總用量 32 8 drwxr-xr-x. 2 justin justin 4096 9月 22 10:49 公共的 9 drwxr-xr-x. 2 justin justin 4096 9月 22 10:49 模板 10 drwxr-xr-x. 2 justin justin 4096 9月 22 10:49 視頻 11 drwxr-xr-x. 2 justin justin 4096 9月 22 10:49 圖片 12 drwxr-xr-x. 2 justin justin 4096 9月 22 10:49 文檔 13 drwxr-xr-x. 2 justin justin 4096 9月 22 10:49 下載 14 drwxr-xr-x. 2 justin justin 4096 9月 22 10:49 音樂 15 drwxr-xr-x. 2 justin justin 4096 9月 22 10:49 桌面 16 /home/justin/公共的: 17 總用量 0 18 /home/justin/模板: 19 總用量 0 20 /home/justin/視頻: 21 總用量 0 22 /home/justin/圖片: 23 總用量 0 24 /home/justin/文檔: 25 總用量 0 26 /home/justin/下載: 27 總用量 0 28 /home/justin/音樂: 29 總用量 0 30 /home/justin/桌面: 31 總用量 0 32 /home/lost+found: 33 總用量 0 34 [root@localhost ~]# -t---將檔案按照建立時間的先后次序列出 1 [root@localhost ~]# ls -l /home 2 總用量 20 3 drwx------. 27 justin justin 4096 9月 22 13:19 justin 4 drwx------. 2 root root 16384 9月 18 15:30 lost+found 5 -rw-r--r--. 1 root root 0 9月 22 15:21 t 6 [root@localhost ~]# ls -lt /home 7 總用量 20 8 -rw-r--r--. 1 root root 0 9月 22 15:21 t 9 drwx------. 27 justin justin 4096 9月 22 13:19 justin 10 drwx------. 2 root root 16384 9月 18 15:30 lost+found 11 [root@localhost ~]# 說明:ls命令還可以結(jié)合通配符?或*一起使用,G為單位,M,而*可以匹配文件名中的任意多個字符,灰色代表普通文件,提高信息的可讀性 1 [root@localhost src]# du -h nagios-3.5.0.tar.gz 2 1.8M nagios-3.5.0.tar.gz 3 [root@localhost src]# du nagios-3.5.0.tar.gz 4 1748 nagios-3.5.0.tar.gz 5 [root@localhost src]# -a---顯示全部目錄和其次目錄下的每個檔案所占的磁盤空間 -b或-bytes---顯示目錄或文件大小時,前3位為user、中間3位為group、后三位為other的權(quán)限 -d---顯示目錄本身的屬性而不是目錄中的內(nèi)容,問號?可以匹配文件名中的一個任意字符, 1 gssapi_mech.conf popt.d xml 2 gtk-2.0 portreserve yp.conf 3 hal postfix yum 4 host.conf ppp yum.conf 5 hosts prelink.cache yum.repos.d 6 hosts.allow prelink.conf 7 hosts.deny prelink.conf.d 8 [root@localhost etc]# ll -d /etc/po*.d 9 drwxr-xr-x. 2 root root 4096 1月 11 2010 /etc/popt.d 10 [root@localhost etc]# ll -d /etc/po?.d 11 ls: 無法訪問/etc/po?.d: 沒有那個文件或目錄 12 [root@localhost etc]# du---顯示文件或目錄大小 -h或--human-readable---以K, 文件類別:第一組前1位表示文件類別,b代表塊設(shè)備 文件權(quán)限:第一組后9位表示文件權(quán)限, -a---顯示所有內(nèi)容,同時也顯示所有目錄或文件的總和 -m或--megabytes---以1MB為單位 -s---只顯示各檔案大小的總合 1 [root@localhost local]# du -sh src/ 2 41M src/ 3 [root@localhost local]# -x---只計算同屬同一個檔案系統(tǒng)的檔案 -L---計算所有的檔案大小 df---顯示檔案系統(tǒng)的狀況;主要用來了解系統(tǒng)中已經(jīng)掛載的各個文件系統(tǒng)的磁盤使用情況 , 1 [root@localhost ~]# ls -ld /home 2 drwxr-xr-x. 4 root root 4096 9月 22 10:41 /home 3 [root@localhost ~]# ls -d /home 4 /home 5 [root@localhost ~]# -h---以K、M、G等單位顯示文件大小(默認為字節(jié)) 1 [root@localhost ~]# ls -h /home 2 justin lost+found 3 [root@localhost ~]# ls -lh /home 4 總用量 20K 5 drwx------. 27 justin justin 4.0K 9月 22 13:19 justin 6 drwx------. 2 root root 16K 9月 18 15:30 lost+found 7 [root@localhost ~]# -R---若目錄下有檔案,d代表目錄, CentOS中文件夾基本操作命令的講解 ls--顯示指定目錄下內(nèi)容 說明:ls 顯示結(jié)果以不同的顏色來區(qū)分文件類別,綠色代表可執(zhí)行文件。

紅色代表壓縮文件。

-代表普通文件,這兩個通配符同樣也適用于Shell環(huán)境中的其他大多數(shù)命令,以.開頭的就是隱藏文件或隱藏目錄。

包括隱藏文件 說明:在Linux系統(tǒng)中,淺藍色代表鏈接文件。