You can use Linux mv command to rename a file or directory provided the destination file or directory does not exist.
In the case of a file, if the destination is a file and it exists, mv will try to overwrite the destination file with the content of the source file. If the destination is a directory, mv command will move the source file inside the destination directory.
In the case of a directory, if the destination directory exists, mv command will move the source directory inside the destination directory and if the destination directory does not exist, mv command will rename the destination directory with the source directory name.
mkdir mydir && touch myfile ## create one file and directory
ls ## returns mydir myfile
mv mydir mynewdir ## renames mydir to mynewdir
mv myfile mynewfile ## renames myfile to mynewfile
ls ## returns mynewdir mynewfile
rm -r my*