The Wayback Machine - https://web.archive.org/web/20230512155934/https://www.geeksforgeeks.org/rename-command-in-linux-with-examples/
Skip to content
Related Articles
Get the best out of our app
GeeksforGeeks App
Open App
geeksforgeeks
Browser
Continue

Related Articles

rename command in Linux with Examples

Improve Article
Save Article
Like Article
Improve Article
Save Article
Like Article

rename command in Linux is used to rename the named files according to the regular expression perlexpr. It can change the name of the multiple files. If the user will not specify any file names on the command line with this command then it will take the file name from the standard input.

Syntax:

rename [options] expression replacement file...

Options:

  • rename -s: This option renames the files ignoring the symbolic links.

    Example:

    rename -s 's/root/new/' sym.png

  • rename -v: This option is used to show which files is being renamed, if there is any.

    Example:

    rename -v 's/jpeg/png/' *.jpeg

  • rename -n : This option comes into play when the user wants to see only the final change.

    Example:

    rename -n 's/png/jpeg/' *.png

  • rename -o : This option will not going to overwrite the existing files.

    Example:

    rename -o 's/jpeg/png/' *.jpeg

  • rename -V: This option will show the version information and exit.

    Example:

    rename -V 's/jpeg/png/' *.jpeg

  • rename -help : This option will going show the help message and exit.

    Example:

    rename -help

My Personal Notes arrow_drop_up
Last Updated : 24 May, 2019
Like Article
Save Article
Similar Reads