du -k -s * |sort -nthis will list the directories and files in the current directory in asc order so that the last one you see is the largest. Using this it is easy to move down the directory tree and quickly identify the offending files.
Programing, Shell scripting, Windows, Linux. I'm using this as a repository for all those niggling little tasks that get done just often enough to be annoying, but maybe not often enough to commit to memory, and other things I feel like writing about.
Thursday, February 21, 2008
Finding Disk space Hogs
Using date in file name (and compressing files)
Yea this is stupid an easy, and also very annoying if you forget how!
backup=`date +%Y%m%d`That backs up all the current .sql files in a directory into a file with todays date as the name
tar czvf SQL-$backup.tar.gz *.sql
Deleting Files over Certain Age
The command to delete files over a certain age is deceptivly easy in linux.
find * -mtime +5 -exec rm {} \;
That finds all files over 5 minutes old in the current directory. This is quite usefull in a backup script run from cron.
Tuesday, February 5, 2008
VMWare Server (Guests very slow)
If you are having trouble with guest machines being slow it could be because they don't have any shared memory setup. Make sure you have /dev/shm setup with tmpfs and at least half your physical memory mounted. Then add tmpDirectory="/dev/shm" to your /etc/vmware/config file and restart vmware. (Full directions at above link).