This article introduces how to check file/folder size with the Bash du command in Linux PC/server command lines.
- Example of outputting only files/folders over 1000M bytes
- Ignore error output and output files/folders over 3GB to standard output + file output
2>/dev/nullโ Ignore error output like cannot read directory / Permission denied.
<ul>
<li>If you want to know the total capacity of a folder for now</li>
</ul>
user@pc:/mnt/c/share/anime$ du -h 62G ./watched 1.7G ./_anime 9.6G ./_movie 26G ./_yet 181G .
<ul>
<li>If you want to know folder sizes (don't output folders under 1GB and errors)</li>
</ul>
du -hm 2>/dev/null | awk โ{if($1 > 1000){print $1, $2}}โ
<ul>
<li>Want to know the total capacity of the current directory</li>
</ul>
du -h |tail -1
Reference:
[ใ du ใ Display file capacity in directory](http://itpro.nikkeibp.co.jp/article/COLUMN/20060227/230748/)