Breaking News

How to rename a file/directory using mv command

Renaming a file or directory in Linux is very simple and it will take few steps!
I'm using a Kali Linux but don't worry, any version apart from this Kali, the command can work.

  • Open your Linux Machine
  • Now Open terminal (This will be used to write a command that will rename a file/directory)

  • On Terminal, navigate to where your file/directory has been created and you need to rename. Example, I need to rename my file and directory located on Desktop, I will type the following command
  • cd /root/Desktop (This will change the current directory to Desktop)

  • Now type the following command while you are at Desktop and press enter.
  • mv File Document (mv is a command that will rename a file called File to new name called Document)

  • As you can see, file has been renamed to new name called Document. This command also can be used to rename even a directory (folder), so now lets rename a folder called Directory to new name called Folder. Type the following command to do that task.
  • mv Directory Folder (mv is a command that will rename a folder called Directory to new name called Folder)

  • We Done!! We have already rename both file and directory.

Please comment and share with your friends. The next post will be on how to delete a file/directory.
Thank you for reading....!!!