How do rename a directory via the command line Ubuntu

mv /home/user/oldname /home/user/newname

o just rename a file or directory type this in Terminal:

mv old_name new_name 

with space between the old and new names.

To move a file or directory type this in Terminal.

mv file_name ~/Desktop 

it will move the file to the desktop.

If is a directory you should add -R before the directory name:

mv -R directory_name ~/Desktop


This gvfs-move command will also rename files and directories.

gvfs-move /home/user/oldname /home/user/newname