/
working with files in the command line
working with files in the command line
#### 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
, multiple selections available,
Related content
Manually transferring drupal files with rsync
Manually transferring drupal files with rsync
More like this
connecting to remote MySQL servers
connecting to remote MySQL servers
Read with this
Drupal Audit Process
Drupal Audit Process
More like this
Local Development Environment
Local Development Environment
Read with this
WordPress Audit Process – DEPRECATED
WordPress Audit Process – DEPRECATED
More like this
Manually building a Kalastack with Solr
Manually building a Kalastack with Solr
Read with this