• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • VCS
  • Interview Questions
  • Database
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

rename Command Examples in Linux

by Deepika

The rename command is a utility in Unix-like operating systems that allows you to rename multiple files at once. It is used to change the names of files and directories, and it provides a powerful and flexible way to manipulate file names.

The rename command can also be used with regular expressions, allowing you to match more complex patterns in file names and perform more sophisticated transformations. This makes it an extremely useful tool for bulk renaming of files, especially in scenarios where you need to rename a large number of files or where the names of the files have a specific pattern.

rename Command Examples

1. Rename files using simple substitutions (substitute ‘foo’ with ‘bar’ wherever found):

# rename foo bar *

2. Dry-run – display which renames would occur without performing them:

# rename -vn foo bar *

3. Do not overwrite existing files:

# rename -o foo bar *

4. Change file extensions:

# rename .ext .bak *.ext

5. Prepend “foo” to all filenames in the current directory:

# rename '' 'foo' *

6. Rename a group of increasingly numbered files zero-padding the numbers up to 3 digits:

# rename foo foo00 foo? && rename foo foo0 foo??

Filed Under: Linux

Some more articles you might also be interested in …

  1. hashcat: command not found
  2. cordova: Mobile apps with HTML, CSS & JS
  3. wdctl: command not found
  4. make: command not found
  5. auditd Command Examples in Linux
  6. rtorrent: command not found
  7. atoum: A simple, modern and intuitive unit testing framework for PHP (Command Examples)
  8. ldapsearch Command Examples
  9. apt-add-repository: command not found
  10. netcat Command Examples in Linux

You May Also Like

Primary Sidebar

Recent Posts

  • Vanilla OS 2 Released: A New Era for Linux Enthusiasts
  • mk Command Examples
  • mixxx Command Examples
  • mix Command Examples

© 2025 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright