my system-mutilating cleaning script

August 4, 2009 at 09:47 | Posted in Scripts | Leave a comment
Tags: ,

#!/bin/sh

echo “updating slocate database…”
sudo updatedb

echo “searching for and deleting instances of *.bak files…”
locate -i -r .bak$ | sed ‘s/ /\\ /g’ | sudo xargs rm -Rv

echo “searching for and deleting instances of *.*~ files…”
locate -r ~$ | echo
# (I added this step because it would delete files like “~Final Fantasy VIII~” as well T_T)
read | echo “press enter to continue and delete files listed above”
locate -r ~$ | sed ‘s/ /\\ /g’ | sudo xargs rm -Rv

echo “removing all found instances of Thumbs.db…”
locate -r /Thumbs.db$ | sed ‘s/ /\\ /g’ | sudo xargs rm -Rv

echo “deleting contents of trash…”
sudo rm -Rv /home/susie/.local/share/Trash
sudo rm -Rv /root/.local/share/Trash

echo “removing thumbnail cache…”
sudo rm -Rv /home/susie/.thumbnails
sudo rm -Rv /root/.thumbnails

echo “removing .serverauth files…”
sudo rm -Rv /home/susie/.serverauth*

echo “deleting temporary files…”
echo “(note: will cause some programs to work improperly this session)”
sleep 2
sudo rm -Rv /tmp/*

echo “re-updating slocate database…”
sudo updatedb

echo “finished.”
exit

edit — Actually, I just read here that the .serverauth files can be prevented altogether.

Blog at WordPress.com. | Theme: Pool by Borja Fernandez.
Entries and comments feeds.

Follow

Get every new post delivered to your Inbox.