Using the command given below, the directory can be renamed in Linux.
mv /home/user/oldname /home/user/newname
If you want to rename multiple directories on Linux, you need to create a new script file and use the “mv” command in a “for” loop to iterate over directories.
Code snippet:
#!/bin/bash
# Takes directory entries specified and renames them using the pattern provided.
for directory in *
do
if [ -d "$directory" ]
then
mv "${directory}" "${directory}_temp" || echo 'Could not rename '"$directory"''
fi
done