Deletes one or more
files. To remove a file, you must have write permission in the directory that contains the file, but you need not have permission on the file itself. If you don't have write permission on the file, you will be prompted (
n) to override.
Note that on symbolic links, rm removes the link, not the target file.
If any of the files you're removing begin with a dash, put a -- in front of them. For instance, if you create a file called -f (dash eff), use rm -- -f to remove it.
All options following are filenames, not options.
Remove directories, even if they are not empty.
Remove write-protected files without prompting.
y (remove the file) or
n (don't remove the file).
Cause rm to overwrite files three different times before deleting them.
file is a directory, remove the entire directory and all its contents, including subdirectories. This option can be dangerous.
Turn on verbose mode. rm prints the name of each file before removing it.
Undelete files on a union filesystem that whiteouts have been applied over.
If any of the files you're removing begin with a dash, put a -- in front of them. Say you create a file called -x:
ls > -x$
rm -xrm: invalid option -- x Try 'rm --help' for more information.
The -x is taken as an option to rm. Instead, put the -- in front:
rm -- -x