educative.io

File Renaming command not working on Bash or Zsh

rename -n 's/(.*)/new$1/' * not working on zsh or bash
.
.
Bash output

➜ learnBash bash
The default interactive shell is now zsh.
To update your account to use zsh, please run `chsh -s /bin/zsh`.
For more details, please visit https://support.apple.com/kb/HT208050.
bash-3.2$ 
bash-3.2$ rename -n 's/(.*)/new$1/' *
bash: rename: command not found
bash-3.2$ 
bash-3.2$

.
.
ZSH output

➜ learnBash  rename -n 's/(.*)/new$1/' *
zsh: command not found: rename
➜ learnBash
1 Like

Hi @Prashant_Kumar_Meena, thank you so much for reaching out to us. The rename command is not by default installed, try using apt-get install rename before running the rename command. If the issue is not resolved by this then please do let me know. Thanks.