Determine size of directories in Linux


Use the du command to determine the size of multiple directories within the Linux file system. It supports multiple parameters but I usually prefer using it as follows:
du -sch *
-c, –total
              produce a grand total
-s, –summarize
              display only a total for each argument
-h, –human-readable
              print sizes in human readable format (e.g., 1K 234M 2G)
 
Determine size of directories in Linux
du –max-depth=1 -B M | sort -n
–max-depth=N
              print the total for a directory (or file, with –all) only if it is N or fewer levels below the command line argument;  –max-depth=0 is the same as  –sum-marize
-B, –block-size=SIZE  
              use SIZE-byte blocks  M (megabytes)
Sort with -n is used to  compare according to string numerical value
 
Determine size of directories in CentOS
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s