HostOnNet Blog

Linux mv command to move or rename directory

Looking for Linux Server Admin or WordPress Expert? We can help.

Linux Commands.gif

mv command is used to move/rename files or directories. mv command is different from cp command. mv command completely removes the file from the source and moves to the directory specified, where cp command just copies the content from one file to another.

Use this command to move and rename file

mv [old filename] [new filename]

Moving a file to another directory

 mv index.php games/index.php 

Moving a file to another directory and renaming it at once

 mv banner_new.jpg ads/banner_1.jpg 

original file will be deleted as it was moved to another location, You can also move a folder

Moving “mysql” folder to “backup” folder

mv mysql/ backup 

About Annie

I've been working in Technical Section for over 10 years in a wide range of tech jobs from Tech Support to Software Testing. I started writing blog for my future reference and useful for all.

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.