If you want to mass rename or bulk rename all the files in a folder in Ubuntu by replacing a part of the file name with another string, then use the bash script or command below. You can replace the extension “*.txt” in the command below with the extension of files you want to rename.
for i in *.txt; do mv "$i" ${i/find/replace}; done
Code language: Bash (bash)
For example, suppose you have file names like “Mydoc1.txt”, “Mydoc2.txt”, etc. And you want to change them to “Myfile1.txt”, “Myfile2.txt”, etc. Then the command would be
for i in *.txt; do mv "$i" ${i/doc/file}; done
Code language: Bash (bash)