![]() |
[-help] [-version] [-verbose] name...
This manual page documents the GNU version of rm. rm removes each specified file. By default, it does not remove directories. If a file is unwritable, the standard input is a tty, and the -f or -force option is not 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.
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 - -for
rm ./-fThe Unix rm program's use of a single `-' for this purpose predates the development of the getopt standard syntax.
joe@localhost $ ls -l
-rw-rw-rw- 1 joe joe 0 Mar 26 19:22 firstfile
-rw-rw-rw- 1 joe joe 0 Mar 26 19:22 fourfile
-rw-rw-rw- 1 joe joe 0 Mar 26 19:22 lastfile
-rw-rw-rw- 1 joe joe 0 Mar 26 19:22 onefile
joe@localhost $ rm onefile
rm: remove `onefile'? y
joe@localhost $ ls -l
-rw-rw-rw- 1 joe joe 0 Mar 26 19:22 firstfile
-rw-rw-rw- 1 joe joe 0 Mar 26 19:22 fourfile
-rw-rw-rw- 1 joe joe 0 Mar 26 19:22 lastfile