du – Derek Demuro https://www.derekdemuro.com Software Engineer Sat, 12 Dec 2020 22:45:37 +0000 en-US hourly 1 160473225 du command, disk usage with style! https://www.derekdemuro.com/2014/02/27/du-command-disk-usage-with-style/ https://www.derekdemuro.com/2014/02/27/du-command-disk-usage-with-style/#respond Thu, 27 Feb 2014 06:48:26 +0000 https://www.derekdemuro.com/?p=3321 Disk usage: working with du command in linux.

Sometimes we need to work with disk usage in Linux terminals and work with files, such as finding the most critical files in the system for rogue backups or files or simply contraband.

Lets go with:

Find folder size in human readable [Gigs, Megs, Bytes…]

On the right we can see an example using du, with max-depth=1 [Meaning only the root].

du command

$ du -a
0   ./redhat/rh7
4   ./redhat
4   ./testfile.txt
0   ./linuxKernel
0   ./ubuntu/ub10
4   ./ubuntu
16  .

du human readable

$ du -ah
0   ./redhat/rh7
4.0K    ./redhat
4.0K    ./testfile.txt
0   ./linuxKernel
0   ./ubuntu/ub10
4.0K    ./ubuntu
16K .

du exclusion

du -cbha --exclude="*.txt"
0   ./redhat/rh7
4.0K    ./redhat
0   ./linuxKernel
0   ./ubuntu/ub10
4.0K    ./ubuntu
12K .
12K total

du custom display type.

$ du -cbha --time
0   2012-05-22 21:52    ./redhat/rh7
4.0K    2012-05-22 21:52    ./redhat
3   2012-06-18 19:23    ./testfile.txt
0   2012-05-22 21:52    ./linuxKernel
0   2012-05-22 21:52    ./ubuntu/ub10
4.0K    2012-05-22 21:52    ./ubuntu
13K 2012-06-18 19:23    .
13K 2012-06-18 19:23    total
]]>
https://www.derekdemuro.com/2014/02/27/du-command-disk-usage-with-style/feed/ 0 3321