How/Command to rename a File/Directory – Unix/Linux

Hi all, we already discussed about the move (mv) command and the different switches of mv command. Here, we can use the “mv” command to rename a file or directory under Linux.


mv name newname

name – is the name of File/Dir
newname – is the new name for selected File/Dir

Here, I’ve created one folder “CryBit” to illustrate the usage of “mv”.

[root@localhost ~]# mkdir CryBit
[root@localhost ~]# ll -d CryBit/
drwxr-xr-x. 2 root root 4096 Mar 14 21:03 CryBit/

Renaming CryBit directory to Test.

[root@localhost ~]# mv CryBit/ Test
[root@localhost ~]# ll -d CryBit/
ls: cannot access CryBit/: No such file or directory
[root@localhost ~]# ll -d Test/
drwxr-xr-x. 2 root root 4096 Mar 14 21:03 Test/

That’s it..!! 🙂


Other useful Linux commands:
groupdel, groupmems, groupmod, useradd , usermod , chgrp, chown, ls, head, tail, top, ps, find, crontab, ftp commandstar, rpm, rkhunter, Rsync, grep,  OpenVZ commands, lsof command

Arunlal Ashok

Sr. Linux Server Administrator. I'm managing Linux servers since 2012. I started this blog to share and discuss my ideas. Check My Profile in uPwork (oDesk) and create a job, if you need any administration help. Thanks!!

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *