1. 程式人生 > >linux檢視當前檔案和資料夾大小

linux檢視當前檔案和資料夾大小

Linux檢視檔案和資料夾大小

1、du -sh 檢視當前資料夾大小

du -sh * | sort -n 統計當前資料夾(目錄)大小,並按檔案大小排序

附送:
du -sk filename 檢視指定檔案大小


2、 Linux:ls以K、M、G為單位檢視檔案大小

#ls -lhs

舉例比較:

# ls
cuss.war nohup.out

# ls -l
total 30372
-rw-r--r-- 1 root root 31051909 May 24 10:07 cuss.war
-rw------- 1 root root 0 Mar 20 13:52 nohup.out

# ls -lh
total 30M
-rw-r--r-- 1 root root 30M May 24 10:07 cuss.war
-rw------- 1 root root 0 Mar 20 13:52 nohup.out

# ll -h
total 30M
-rw-r--r-- 1 root root 30M May 24 10:07 cuss.war
-rw------- 1 root root 0 Mar 20 13:52 nohup.out

# ls -lhs
總計 28G
15G -rw-r--r-- 1 root root 15G 06-04 14:35 all.txt
8.0K -rwx--x--x 1 root root 632 06-04 15:57 hash.pl