with options in:
[-a] [--all] [-c] [--check-only] [-d] [--default] [-e] [--delete-empty-dir] [-f[filename]] [--output[=filename]] [-g[#]] [--gentle[=#]] [-h] [--help] [-i] [--interactive] [-j] [--empty-junk-dir] [-l] [--follow-symbolic-links] [-mmodename] [--mode=modename] [-n] [--no-recursion] [-o] [--options] [-p] [--process-todo-file] [-r] [--generate-report] [-s] [--silent] [--quiet] [-u] [--unprotect] [-v] [--standard-output] [-w] [--with-warnings] [-x] [--strip-executables] [-z] [--zap-invalid-links] [-C] [--code-dump] [-D] [--debug] [-V] [--version]
-f
for instance), for eveything that follows will be consdered as the
parameter.
-m
option).
-f
and -p
options (see below).
clean -do
-f
or --output
), the report will be saved in the file
$HOME/.clean-history. The result can be parsed by the -p
option.
setpriority
function (e.g. Solaris 2.x), it will display a warning and go on with
normal priority.
-m
mode, the config file will be changed to $HOME/.cleanrc-mode, and will be read. This option can only be specified on the command-line.
If you put it in the OPTIONS
directive of your config file, it will be silently ignored.
-o
flag. The program exits just after the display.
Note that the regexps are not displayed ``as is'', but that common regexp
parts (.+
, \.
) are replaced by the corresponding shell metacharacters <*
, .
).
clean -cf
). Here are the three lines that sum it all up:
clean -cf # Run clean in check-only mode vi ~/.clean-history # Remove unwanted actions clean -pf # Process the remaining todo file
-f
option ?
$debugmode
to 1. Internal use only.
It also can delete empty dirs, specified dirs, and invalid symbolic links. It can empty temporary and cache dirs, and warn about world-writable or empty files.
You can configure it through the file $HOME/.cleanrc.
command=parameters
You can add commentaries in your config file. They must begin with a
#
. Everything following a #
will be ignored.
Blank lines are also authorized.
DEL=.+~ -1 # backup files
will erase all backup files. If the age is not relevant, put -1 or nothing. No test will then be made on the age of the file.
-a
flag is set. The parameters are the same as for the
DEL command. For instance,
DELOPT=.+\.o # object files
will erase all object files. If the age is not relevant, put -1 or nothing. No test will then be made on the age of the file.
ZIP=.+\.e?ps 30 # eps or ps files
will compress all postscript files older than 30 days.
-a
flag is set. The parameters are the same as for the ZIP
command. For instance,
ZIPOPT=.+\.dvi -1 # dvi files
will compress all dvi files
DELDIR=\.wastebasket -1
will delete the .wastebasket
directory.
~
in the pathname is expanded to home directory. If an age is given, files
are deleted only if they are older than the specified age Classical use is:
EMPTYDIR=/usr/tmp 3 EMPTYDIR=~/.netscape/cache
This option is activated only when the -j
(junk directories) options is set.
-d
switch sets the builtin default options, not the ones set in the config
file. For instance,
OPTIONS=-d -x -r
will set the default options, then the -x
option (strip executable files), and then the -r
option (report).
These options can be overriden by the command line options. All the options (these set in the config file, and the command line ones) are read from left to right. So, if you specify
OPTIONS=-f -v
where -f
means send output to the file $HOME/.clean-history, and
-v
means send output to STDOUT, only the last one (STDOUT) will be taken into
account.
The default value is /usr/bin/file.
PROTECT=~/c
will protect the directory $HOME/c. The script won't event try to enter it. The ~ is expanded to your home directory.
-f
option is given. Its value can be overwritten by the value given on the
command-line.
WARNING
messages. Note: you cannot use a whitespace in the regexp (it is used as parameter
delimiter), so use the \s class.
For example,
HIDE_MESSAGE=WARNING is\sempty
will hide all warning messages containing the string ``is empty''. Use with caution. A badly written regexp could hide text that was not intended to be hidden.
I know that the display levels are not documented. To know them, just do a grep WARNING
on the program itself.
CLEANRC
.
There is a list of unauthorized regexps at the beginning of the script. It is an attempt to improve security, as the script can be very harmful. It also checks the permissions on the config file.
To see the default options, just run clean -o
.
The first time you run the program, it will ask you wether to create the config file (answer yes, it cannot hurt), display the different options, and stop. It will not do any deletions or compressions. You will have to run it again to actually delete something.
If you don't trust the program, you can run clean -c
, which will only print the things to do (files to delete, files to
compress, etc...) without actually doing it, so you can check that its
choices are right.
See also the part about the -p
option (and the example).
And from the old System V.2 administrator's guide:
``Making files is easy under the Unix operating system. Therefore, users tend to create numerous files using large amounts of file space. It has been said that the only standard thing about all Unix systems is the message-of-the-day telling users to clean up their files.''
clean -cf; vi ~/.clean-history; clean -pf
which does a check-only run with the result in the ~/.clean-history file, lets you edit it to remove unwanted actions and then processes it.
clean -gwx
cleans the current directory with warnings on, a nice priority and trying to spot unstripped executables.
CLEANRC
: path of the configuration file.
PATH
: used to determine the absolute path to gzip, file and strip
GZIP
: used by gzip
$HOME/.clean-history
<Olivier.Aubert@enst-bretagne.fr>
based on an idea by Olivier MORBE.
The filesize report is not very accurate (or maybe too much). It does not
round the size to the block size as du(1)
does.