2007 May 08 - Tue
Determiniing Space Used in SubDirectories
When space is getting tight, one has to find out where the space is being used.
Sometimes it suffices to find where the most accumulation is and cleaning that up. To find
that accumulation, use the du command:
du -h -x --max-depth=1
The -h turns the result into human readable form, the -x excludes files on a different
file system (for when you have a mount somewhere in the structure), and the --max-depth
performs a summarizes the results of the recursive search through the structure.
[/OpenSource]
permanent link
Removing lots of files
If I don't have a clean up program running, sometimes autocollected files tend to
accumulated. For example, netflow processing on 5 minute intervals can accumulate a large
number of files. An 'rm' with a partical wild card seems to complain.
I've resorted to a chaining some command line utilities to come up with a quick script to
remove files:
ls -1 | grep ft-v05.2007-0[123] | sed 's/^/rm /' > t.sh
This generates a one column directory listing and puts it through grep. Grep looks for a
few specific months of files and passes the list onto sed. Sed preappends the removal
command onto each file name. The whole shooting match is thrown into a shell script.
Either set execute privileges on the script:
chmod 500 t.sh
Or run with with the shell command:
bash t.sh
[/OpenSource]
permanent link
|