


To remove a file whose name starts with a '-', for example '-foo', use one of these commands: Use the -recursive ( -r or -R) option to remove each listed directory, too, along with all version output version information and exitīy default, rm does not remove directories. r, -R, -recursive remove directories and their contents recursively preserve-root do not remove '/' (default) no-preserve-root do not treat '/' specially one-file-system when removing a hierarchy recursively, skip any directory that is on a file system different from that of the corresponding command line argument Prompt according to WHEN: never, once ( -I), or always ( -i). Less intrusive than -i, while still giving protection against most I prompt once before removing more than three files, or when removing recursively. f, -force ignore nonexistent files, never prompt If the response is not affirmative, the file is interactive=always option is given, rm prompts the user for whether to remove the file. Otherwise, if a file is unwritable, standard input is a terminal, and the -f or -force option is not given, or the -i or If the response is not affirmative, the entire command is aborted. Given, then rm prompts the user for whether to proceed with the entire operation. If the -I or -interactive=once option is given, and there are more than three files or the -r, -R, or -recursive are rm removes each specified file.īy default, it does not remove directories. *: Searches the Home directory for names matching the provided expression.This manual page documents the GNU version of rm./Example_Directory/: Defines the replacement or the new directory name./ Directory1: Specifies the expression or the part of the old directory name that you want to replace.s: Short for substitute, indicates that we are replacing the expression with the replacement.In this example, we can see that the rename command syntax consists of several sections: For example, if we want to rename Directory1 to Example_Directory: rename 's/Directory1/Example_Directory/' * The command renames the file by replacing the first occurrence of the expression with the replacement. The rename command uses the following syntax: rename 's///' Renaming a Single Directory With the rename Command For Arch Linux, use sudo pacman -S rename.For CentOS and Fedora, use sudo yum install prename.

For Ubuntu and Debian, use sudo apt install rename.If your system is missing the rename command, install it with: Note: The rename command is not included in all Linux distributions by default.
