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

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • VCS
  • Interview Questions
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

rename: command not found

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.

If you encounter the below error while running the command rename:

rename: command not found

you may try installing the below package as per your choice of distribution:

Distribution Command
Debian apt-get install util-linux
Ubuntu apt-get install util-linux
Alpine apk add util-linux
Arch Linux pacman -S util-linux
Kali Linux apt-get install util-linux
CentOS yum install util-linux
Fedora dnf install util-linux
OS X brew install rename
Raspbian apt-get install util-linux

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. Linux / UNIX : How to create primary partition using fdisk
  2. debootstrap Command Examples in Linux
  3. logrotate: command not found
  4. cewl Command Examples in Linux
  5. CentOS / RHEL 6 : How to limit memory resources for a specific user using cgroups
  6. How to Check whether SELinux is Enabled or Disabled
  7. Understanding /etc/hosts file in Linux
  8. Linux OS Service ‘portreserve’
  9. tee Command Examples in Linux
  10. restorecon: command not found

You May Also Like

Primary Sidebar

Recent Posts

  • protonvpn-cli Command Examples in Linux
  • protonvpn-cli connect Command Examples
  • procs Command Examples in Linux
  • prlimit: command not found

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright