ForumCategory: LinuxHow do I rename files in Linux using the command line?
AvatarCodeBook asked 6 months ago
I usually use the mv command to rename files. It's pretty straightforward. Just type mv oldfilename newfilename
1 Answers
AvatarCircuitDesigner answered 6 months ago

If you need to rename multiple files at once, you can use a for loop in a Bash script. I find this method really helpful for batch renaming. For example:
!/bin/bash
for f in .txt; do
mv "$f" "${f%.txt}.pdf"
done

This script changes the extension of all .txt files in the current directory to .pdf.