搜尋此網誌

2017年11月13日 星期一

透過 DU 指令,找出目錄底下體積最大的前 5 個檔案

透過 DU 指令,找出當下目錄底下體積最大的前 5 個檔案

du -h -s * | sort -rn | head -5

如果要查其他目錄,只要修改上述 * 號,例如:

du -h -s /* | sort -rn | head -5



還有更方便的工具,但是需要額外安裝 ncdu

ncdu -q -x

-q Quiet mode, doesn't update the screen 10 times a second
   while scanning, reduces network bandwidth used

-x Don't cross filesystem borders (don't descend into a
   directory which is a mounted disk)




沒有留言:

張貼留言

搜尋此網誌