UNIX Programming, Certification, System Administration, Performance Tuning Reference Books
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 <dirname>

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

Return to : Unix System Administration Hints and Tips