« Home | GREP TEXT NOT BINARY » | REBOOTING BECAUSE OF FORK BOMBS » | Get the hidden files » | Building a Linux supercomputer using SSH and PVM » | Accessing Positional Variables » | Linux Renaming Sets of Files » | Separate Shell Command history » | NFS between Solaris & Linux » | How To Set Up Database Replication In MySQL » | My sysadmin toolbox » 

Friday, May 05, 2006 

CLEANING DIRECTORIES

The creation of many temporary files in Unix during compilations, occupies a lot of memory space. This can be got rid of by using a simple script.

find $1 \( -name a.out -o -name '*.o' -o -name 'core' -o -name '*.ii' -o -name '*.ti' -o -name '*.class' -o -name '*.pur' \) -exec rm {} \;

Save the above line in a file and run this file after changing permissions. For example, if the file containing the above code has the name 'clean', then:

example% clean

will remove all the files specified in the script in the directory and all other subdirectories within it. You can add or remove any number of files in the script, to suit your needs.

Links to this post

Create a Link