GNU Info

Info Node: (fileutils.info)rm invocation

(fileutils.info)rm invocation


Next: shred invocation Prev: mv invocation Up: Basic operations
Enter node , (file) or (file)node

`rm': Remove files or directories
=================================

   `rm' removes each given FILE.  By default, it does not remove
directories.  Synopsis:

     rm [OPTION]... [FILE]...

   If a file is unwritable, standard input is a terminal, and the `-f'
or `--force' option is not given, or the `-i' or `--interactive' option
_is_ given, `rm' prompts the user for whether to remove the file.  If
the response does not begin with `y' or `Y', the file is skipped.

   The program accepts the following options.  Also see Note: Common
options.

`-d'
`--directory'
     Attempt to remove directories with `unlink' instead of `rmdir', and
     don't require a directory to be empty before trying to unlink it.
     This works only if you have appropriate privileges and if your
     operating system supports `unlink' for directories.  Because
     unlinking a directory causes any files in the deleted directory to
     become unreferenced, it is wise to `fsck' the filesystem after
     doing this. Note that this option will call `unlink' on the target
     with no additional checks, so may be useful for non-directories in
     cases where `stat' fails for the target.

`-f'
`--force'
     Ignore nonexistent files and never prompt the user.  Ignore any
     previous `--interactive' (`-i') option.

`-i'
`--interactive'
     Prompt whether to remove each file.  If the response does not begin
     with `y' or `Y', the file is skipped.  Ignore any previous
     `--force' (`-f') option.

`-r'
`-R'
`--recursive'
     Remove the contents of directories recursively.

`-v'
`--verbose'
     Print the name of each file before removing it.

   One common question is how to remove files whose names begin with a
`-'.  GNU `rm', like every program that uses the `getopt' function to
parse its arguments, lets you use the `--' option to indicate that all
following arguments are non-options.  To remove a file called `-f' in
the current directory, you could type either:

     rm -- -f

or:

     rm ./-f

   The Unix `rm' program's use of a single `-' for this purpose
predates the development of the getopt standard syntax.


automatically generated by info2www version 1.2.2.9