Career Interests

Cleaning up

For whatever reason, there comes a time in life that a person needs to tidy up.  In this case, it happens to be a linux based web server that has miscellaneous files strewn throughout.  Some from editing with emacs/vim/vi which tend to leave backup files (those annoying files with a ~ after them or other marker depending on the editor).  So, here’s what I did to do some cleanup.  Your mileage may vary.

First, determine the kind of files you want to remove and how you want to remove them.  Me, I’m going to use find and I have files ending with ~ and beginning with a ._ that are left over from editing.  So, to make sure I don’t delete anything I don’t want to, I’ll do a check first.  I do this by running “find -name ‘._*’ -print“.  This will find all files beginning with ._ and print them to the screen.  I can then do a check to make sure everything is what I expect it to be.  Once I am sure I want to delete the files listed, I run “find -name ‘._*’ -delete“.  I continue this process for the other files I need to eliminate.

This same process can be ran to match file date, file size and many other attributes. To see the full options under find check out the man page at or just google for it.  Find also allows a person to run an individual script on each file found which could be really useful for processing text files.

By Mark

I work in IT and ride Motorcycles. I do one to support the other.