
To remove a file whose name begins with a dash (" -"), you can specify a double dash (" -") separately before the file name. If the specified directory is empty, it may be removed with the -d/ -dir option, instead. If the -r/ -R/ -recursive option is specified, however, rm removes any matching directories and their contents. Removing directoriesīy default, rm does not remove directories. If the response is not yes/ y/ Y, the file is skipped. If a file is unwritable, stdin is a terminal, and the -f/ -force option is not given, or the -i or -interactive=always option is given, rm prompts the user for whether to remove the file. If the user does not respond yes/ y/ Y to the prompt, the entire command is aborted. If the -I/ -interactive=once option is given, and there are more than three files or the -r/ -R/ -recursive options are specified, rm prompts before deleting anything. Verbose mode explain at all times what is being done. In other words, rm -d is equivalent to using rmdir. This option permits you to remove a directory without specifying -r/ -R/ -recursive, provided that the directory is empty.

Remove directories and their contents recursively. When removing a hierarchy recursively, skip any directory that is on a file system different from that of the corresponding command line argumentĭo not treat " /" (the root directory) in any special way.ĭo not remove " /" (the root directory), which is the default behavior. If WHEN is not specified, then prompt always. Prompt according to WHEN: never, once ( -I), or always ( -i). This option is less intrusive than -i, but still gives protection against most mistakes. Prompt once before removing more than three files, or when removing recursively. Ignore nonexistant files, and never prompt before removing. shred will overwrite the file's contents so that they cannot be reconstructed later. If you want is to completely wipe the data on the disk, use the shred command instead.
