Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Current »

#### DISK USAGE
#see how much disk space you are using run
df -h
# see how much space is used by each top level directory. 
du -smh ./*
#Given the results from there, drill down to the next level. e.g. 
du -smh /var/*
#Then drill down further e.g. 
du -smh /var/log/*
#drill down and find you the biggest few individual directories.
du -mxS / | sort -n | tail
du -mxS . | sort -n | tail
du -smh ./* | sort -n | tail
-h  # human-readable in KB /MB
-k  # Print sizes in 1024-byte blocks
-m  # block size = 1M
-a  # Show counts for all files, not just directories.
-s  #Display only a total for each argument.
-S  # --separate-dirs  Report the size of each directory separately, not including the sizes of subdirectories.
--exclude=PATTERN  # When recursing, skip subdirectories or files matching PATTERN.
                   #For example, `du --exclude='*.o'' excludes files whose names end in `.o'.
# just total in KB/MB
du -skh /home
# total for each file + total at end in readable units
du -kha /home
# use awk regular expressions
du -sk /home | awk '{print "Total: ", ($1 / 1024), "Mb, ", ($1 / (1024 * 1024)), "Gb"}'
# another way to sort
du -a --max-depth=3 / | sort -n | awk '{if($1 > 102400) print $1/1024 "MB" " " $2 }'
du -a --max-depth=3 . | sort -n | awk '{if($1 > 102400) print $1/1024 "MB" " " $2 }'
# or
du -ah --max-depth=3 / | sort -h

#### DISK USAGE
#see how much disk space you are using run
df -h
# see how much space is used by each top level directory. 
du -smh ./*
#Given the results from there, drill down to the next level. e.g. 
du -smh /var/*
#Then drill down further e.g. 
du -smh /var/log/*
#drill down and find you the biggest few individual directories.
du -mxS / | sort -n | tail
du -mxS . | sort -n | tail
du -smh ./* | sort -n | tail
-h  # human-readable in KB /MB
-k  # Print sizes in 1024-byte blocks
-m  # block size = 1M
-a  # Show counts for all files, not just directories.
-s  #Display only a total for each argument.
-S  # --separate-dirs  Report the size of each directory separately, not including the sizes of subdirectories.
--exclude=PATTERN  # When recursing, skip subdirectories or files matching PATTERN.
                   #For example, `du --exclude='*.o'' excludes files whose names end in `.o'.
# just total in KB/MB
du -skh /home
# total for each file + total at end in readable units
du -kha /home
# use awk regular expressions
du -sk /home | awk '{print "Total: ", ($1 / 1024), "Mb, ", ($1 / (1024 * 1024)), "Gb"}'
# another way to sort
du -a --max-depth=3 / | sort -n | awk '{if($1 > 102400) print $1/1024 "MB" " " $2 }'
du -a --max-depth=3 . | sort -n | awk '{if($1 > 102400) print $1/1024 "MB" " " $2 }'

  • No labels