Friday, March 09, 2007

Quick Sysadmin Tip

Ever noticed you're running out of room on a partition and you'd like to free up some space quickly that may be hidden in unused directories? Here's a quick and easy way using the du command:
  1. Find the partition that's low on space and cd into it
  2. Do du -sh * | grep G to give a usage summary in human readable form and grepping out any dirs with a gigabyte or more
  3. Look at the results and see if there's any dirs you could remove, or go into further
  4. Repeat steps 2 and 3 until you've gone through the directory tree, removing any unnecessary files and directories
Sure it's only useful for large portions of space, but you could replace the G with an M to get more results. Searching for larger files over a gig is usually quicker and produces better results though.