kruft - purge a filesystem of large and old files on demand
kruft [-abcmnrsTv] [-E exclude] [-I percent] [-S percent] [dirs]
kruft [-abcmnsrTv] [-A oldest] [-E exclude] [dirs]
Do not run this program if you are not sure you now what you are doing.
It will delete many, many files and it doesn't entomb anything.
Kruft is designed to clean out public FTP spools and the like (not your
home directory, or /var/tmp). Casual use of this program from the com-
mand line is insane.
The goal of kruft is to make space on a public filesystem: it removes
files until a space threshold is met, or under -A until all files older
than oldest are expunged.
If the program is called as kruft then no options are forced.
-a | -m | -c | -b | -r
Change which inode time to honor. The b denotes birthtime on
FreeBSD systems (or others that support that). The r denotes
the most recent of access, modify or change time. See find(1).
Change the priority policy to ignore files newer than oldest
seconds, and always remove files older than oldest. The number
of seconds given may be suffixed by a scalar, use a parameter of
question mark (''?'') for units help (see EXAMPLES below).
Any filenames listed in this colon (:) separated list are never
removed. Things like ".profile" or "README" might be included
to prevent their accidental removal.
Print only a brief help message.
Prune by number of files left on device.
Do not execute commands, trace only.
Force a sync of the filesystem after every delete. If you have
softupdates installed on the partition, then kruft may delete
all the files before softupdates frees the space from the first
deletion. This option "fixes" that by forcing kruft to be syn-
chronous (and slow).
Set the goal for this prune to be at most percent space occupied
Truncate (rather then unlinking) targeted files. This is used
to prevent open files from becoming unattached from the filesys-
tem name-space while they continue to grow.
Be verbose. Show actions as shell commands.
Show only kruft's version information.
kruft -S50 -I75 /usr/spool/uucppublic
Clean /usr/spool/uucppublic to 50% space with at most 75% inodes
kruft -S75 -I80 /var/ftp/incoming
Clean /var/ftp/incoming to at most 75% space and 80% inodes
cd /var/unity && xapply -P2 'kruft -A 8h' olrb/[0-9][0-9]
Clean any file older than 8 hours from all the cache directories
under /var/unity/olrb whose name is 2 decimal digits. Note that
xapply(1l) runs 2 in parallel for us.
kruft -r -S80 /var/tmp
Reduce /var/tmp such that the underlying filesystem is at most
80% full, using the most recent time on each file.
kruft -A '?' -V
Display the suffix table for the oldest parameter, and the ver-
sion of kruft.
This sometimes unlink(2)'s open files, which doesn't do any good, but
there is no portable way to see which files are presently open.
The default options should hobble the command to prevent accidental
Defeating entombing in kruft is right on the fine line between clever
and stupid. Assume that any file removed by kruft will never visit a
KS Braunsdorf, NPCGuild.org UNIX Support
kruft at ksb dot not-spam-please npcguild.org
sh(1), purge(8l), untmp(1l), unrm(1l), entomb(7l), xapply(1l), glob(1l)