trash
Section: Linux User's Manual (1)
Updated: 24-Jan-1995
Index
Return to Main Contents
NAME
trash - trashcan substitute for /bin/rm
SYNOPSIS
[1]
trash
file
[
file ...
]
[2]
trash
{
--list
|
--view
}
[3]
trash --empty
[4]
trash --help
DESCRIPTION
trash
provides a simple trashcan facility for the shell command line.
trash
`deletes' files by moving them to a `trashcan' directory, which
defaults to
$HOME/.trash.
trash
can manage a user's trashcan with the
--view
and
--empty
commands.
Trashing Files
To `trash' files,
invoke
trash
with the names of the files to be deleted (style
[1]
above). If a user has permission to move the files using
mv(1),
trash
will be able to put them in the user's trashcan (symbolic links, for
instance, cannot be moved across filesystems).
Going Through the Trash
To look at what's in the trashcan, use the
--list
or
--view
command (style
[2]
above).
trash
will list the contents of the current trashcan directory, including
any hidden files (files whose names begin with `.').
Emptying the Trash
To empty the trash, use the
--empty
command (style
[3]
above).
trash
will remove (i.e., really delete) all the files in the current
trashcan directory, including any hidden files. If
verbose
mode is on (see ENVIRONMENT below),
trash
will echo the name of each file as it is deleted.
Getting Help
To get quick help about
trash,
use the
--help
command (style
[4]
above).
trash
will display a short list of syntax options.
ENVIRONMENT
trash
recognizes the following environment variables:
- TRASH_DIR
-
The directory to use as a trashcan. Defaults to
`~/.trash'.
Other values might be
`/tmp/trash/$USER'
or
`~/garbage'.
It is an error if TRASH_DIR is set to be either the current directory
(.)
or the root directory
(/).
- TRASH_VERBOSE
-
Use
verbose
mode if set to `on', `yes', or `true'. Do not use verbose mode if set
to `off', `no', or `false'. In verbose mode,
trash
prints the names of files as they are either trashed or emptied from
the trash. Defaults to `on'. Any value besides those listed here is
an error.
EXAMPLES
- trash ./junk/*
-
moves all files in the current directory to the trashcan.
- trash ./junk
-
moves the directory
./junk,
and its contents, to the trashcan directory, if the user has write
permission, and if the directories are on the same filesystem.
- trash --view
-
lists the contents of the trash directory.
- trash --empty
-
removes (i.e., really deletes) all files (and directories) in the
trashcan directory. For instance, if we've just trashed
./junk,
which contains two files,
yuck1
and
yuck2,
then `trash --empty' in verbose mode might give us a listing of
-
-
- emptying trashcan `/home/jmk/.trash' ...
-
/home/jmk/.trash/junk
-
-
/home/jmk/.trash/junk/yuck2
-
-
/home/jmk/.trash/junk/yuck1
COMMENTS
It is recommended to alias
trash
to the command normally used for deleting files, and to realias
that command to a different (and harder to type) one, e.g. (using bash):
-
-
- alias rm="trash"
-
- alias remove="/bin/rm"
Used this way,
trash
allows the user to easily un-delete a file that might have been
inadvertently deleted (for example, when mistyping `rm *~' as `rm *'.
SEE ALSO
rm(1),
mv(1)
BUGS
Does not work well for directories or symbolic links on a different
filesystem from the trashcan directory.
Does not provide a facility to prompt the user when emptying the trash
(coming soon?).
Cannot trash files recursively (like `rm -r').
AUTHOR
trash
is written and maintained by Jim Knoble
<jmknoble@mercury.interpath.net>.
trash
is copyright 1995 by Jim Knoble; you may freely distribute and modify
it, but the original code must bear my name. Any modifications that
you introduce must bear your name and must not bear mine.
Index
- NAME
-
- SYNOPSIS
-
- DESCRIPTION
-
- Trashing Files
-
- Going Through the Trash
-
- Emptying the Trash
-
- Getting Help
-
- ENVIRONMENT
-
- EXAMPLES
-
- COMMENTS
-
- SEE ALSO
-
- BUGS
-
- AUTHOR
-
This document was created by
man2html,
using the manual pages.
Time: 15:54:18 GMT, November 05, 2024