The rename command is used to rename files and directories on Linux. The syntax for the rename command is as follows:

rename [OPTIONS] PATTERN NEW_NAME

For example, to rename all files that end in .txt to .html, you would use the following command:

rename 's/\.txt$/.html/' *.txt

Here is a list of some of the most commonly used options for the rename command:

  • -n: Do not actually rename the files, but only print out what would be done.
  • -i: Interactive mode. Prompt before overwriting existing files.
  • -v: Verbose mode. Print out what is being done.
  • -s: Use a substitution expression instead of a regular expression.
  • -l: Replace the last occurrence of the pattern instead of the first one.
  • -c: Count the number of files that are renamed.
  • -f: Force the rename, even if the new file already exists.

For more information on the rename command, you can use the following command:

man rename