Stand With Ukraine

Thursday, June 9, 2016

Bash: check sizes of ALL files in your home directory

This seemingly simple problem drew my attention when I have started getting errors from matplotlib and other applications that try to modify some configuration files in my home directory, which is a sign of an exceeded quota... So I had to figure out which folder was a culprit. My first try to do 'du -shc *' did not give me any big files or folders. This meant that I had to look into the hidden files (names starting with a dot). But doing something simple like 'du -shc \.*' would result in a disaster, the command will go up one level from the home and will be listing the sizes of the files of all users on the system... This is how I got the idea to skip the '.' and '..' files by using an array:


Hopefully, this will save some time to the future me and others who will be looking into which file is causing my quota problems.