rm [-dfiPRrvW] file …
unlink file
(safer less powerful)Remove files
Caution rm *
deletes all the files in the current directory.
Before hand (like now) touch 00-safe; chmod a-w 00-safe
# which will stop rm
with message:
override r--r--r-- usrn/gropn for 0`0-safe?
|
Removes symbolic
Current and parrent directoy cannot be removed by specifing
Exits 0 if all of the named files or file hierarchies were removed, or with
If the permissions do not permit writing and the STDIN is a terminal, the user is prompted on the STDERR, for confirmation.
Accepts
As a failsafe add an
Removes empty directory entries.
Arguments are processed in the order given. In order to remove both a parent directory and a subdirectory of that
parent, the subdirectory must be specified first so the parent directory is empty when rmdir tries to remove it.
.
or ..
.
unlink,
accepts only one non-directory argument and options.
-f
(force) and
all of the existing files or file hierarchies were removed.
--
to stop option list and allows the removal of names begining with -
.
For example: rm -- -filename
Or by using a path reference. For example:
rm /home/user/-filename
If the file (or a link ) was opened by another process the directory entry is removed but, since the inode is still in use,
the file will not be removed nor will the space become available untill all inodes are closed!
rm ./-filename
If you suspect that other processes have the inode in use, BEFORE removing the directory cat /dev/null >fileAboutToBeDeleted
.
rm
script to a directory in the path which issues a cat /dev/null > $*
before
a rm
rmdir
rmdir [-pv] directory …
-p
Directores
are treated as pathnames of which all empty components will be removed
starting with the last most component. (See rm for fully non-discriminant recursive removal.)
-v
verbose, listing each directory as it is removed.
EXIT STATUS
0 Empty directories were removed
>0 An error occurred.
EXAMPLES
Remove the MyEmptyDirectory.
> rmdir MyEmptyDirectory
Remove all directories up to and including priorRun
, stopping at the first non-empty directory
> rmdir -p priorRun/Qtr*/week*
See undelete, unlink, fts, getopt, symlin)