How To Use The rename Command On Linux
In Linux, the rename command is used to rename named files using the regular expression perlexpr. It has the ability to rename numerous files. This command will grab the file name from the standard input if the user does not give any filenames on the command line.
rename [options] expression replacement file...
rename -s: This option ignores symbolic links when renaming files.
rename -s 's/root/new/' sym.png
rename -v: This option displays which files are being renamed, if any are being renamed.
rename -v 's/jpeg/png/' *.jpeg
rename -n: This option is used when the user just wants to view the final result.
rename -n 's/png/jpeg/' *.png
rename -o: This option will not overwrite existing files.
rename -o 's/jpeg/png/' *.jpeg
rename -V: This command displays the version information before exiting.
rename -V 's/jpeg/png/' *.jpeg
rename -help: rename -help: rename -help: This option will display a help message before exiting.
What's the Deal With mv?
mv is in perfect condition. The command works well and is available on all Linux distributions, as well as macOS and other Unix-like operating systems. As a result, it's always accessible. But there are occasions when a bulldozer, not a shovel, is required.
The mv command has just one goal in life: to relocate files. It has the pleasant side effect of being able to relocate an existing file into a new file with a different name. The end result is that the file gets renamed, and we get what we desire. However, mv isn't a specialized file renaming program.