It’s that time of year, tree’s, plants and animals doing there thing. The time of the year where other wildlife and beings start cleaning up since the weather is nice. I guess it’s time for a post on some spring cleaning for the Linux folk
We will start off with a classic, sure to give you a clean start:
rm -rf .
Best done from root, just remember to press CTRL+c and/or reboot as quickly as possible when you realize what you have done.
On a serious note, I had a bunch of annoying hidden files in backup directories I wanted to get rid of. This did the trick.
find . -iname ".*"
find . -iname ".*" | wc -l
find . -iname ".*" | while read i ; do echo rm "$i" >> possibly_remove; done;
The above is conservative. ‘chmod 755 possibly_remove’, verify there are no files in there you actually want, you are in the correct directory then ‘./possibly_remove’ and you’re golden. Mmm. Spring freshness.
Since I like to live on the wild side, I run it without creating a file of files to delete that can be executed like this:
find . -iname ".*" | while read i ; do rm "$i"; done;
This will also work to cleanup nasty files that may have been accumulating a while that may be have left behind. It can be used to find and delete all Thumbs.db files by doing this:
find . -iname "thumbs.db" | while read i ; do rm "$i"; done;
The above is pretty careless, in most cases it probably wouldn’t hurt.
That is all the spring cleaning I have done, except for some random fsck’ing’ that was long overdue.