Suggest Script Helps Reduce Disk Usage

From time to time, people get requests from csehelp to reduce their disk space usage. In order to help people do this, a simple script has been made available in /usr/local/bin/suggest. Most people already have /usr/local/bin in their path and can just type suggest to run the script.

This script finds files in your home directory which meet any of four criteria. First, large files and .tar files are listed as possible targets for compression. Second, files which may not be needed are listed, such as files ending in .tmp. Third, files which have not been read (or modified) in six months are listed. MH users may find quite a few files in this category. If you find whole directories containing information which has not been used, perhaps those directories can be removed, or at least compressed. Finally, files which the system is likely to automatically remove are listed.

The suggest script never removes any files -- it only provides suggestions. The fourth group of files listed are those which will be removed by the cron mechanism automatically. Files ending in ~, starting with #, or named core which remain unmodified for one week have always been automatically removed from the system.

Individual disk usage patterns are often quite unique. The usefulness of the suggest script will therefore vary from user to user. Some users may wish to copy the script and modify it for their own use.

Use the du command to determine how much space a particular directory uses:

	% du -s /cse/grad/student/comp.sys.trs80
	1036    /cse/grad/student/comp.sys.trs80
To condense a directory of files which will not be accessed for a while, use the tar command, then the compress command:

	% tar cf Junk.tar comp.sys.trs80
	% compress Junk.tar
	% du -s Junk.tar.Z
	198     Junk.tar.Z
	% rm -r /cse/grad/student/comp.sys.trs80

For added safety, verify the contents of your tar file before compressing it and removing the originals:

	% tar tvf Junk.tar
	[lengthy list of files]
To restore the files when they are needed, reverse the process:

	% uncompress Junk.tar.Z
	% tar xf Junk.tar
Finally, if you don't have room to uncompress a ".tar.Z" file, the contents can be checked (or extracted) without uncompressing it:

	% zcat Junk.tar.Z | tar tvf -
	[lengthy list of files]
Eric Anderson -- CSE Systems Support Group

Go to next article in this issue

Go back to July-Aug., 1993 Table of Contents