EDUCBA

EDUCBA

MENUMENU
  • Free Tutorials
  • Free Courses
  • Certification Courses
  • 600+ Courses All in One Bundle
  • Login

Linux Move Folder

By Priya PedamkarPriya Pedamkar

Home » Software Development » Software Development Tutorials » Linux Tutorial » Linux Move Folder

Linux Move Folder

Introduction to Linux Move Folder

The move command in Linux is a command-line utility that allows one to move one or more files or directories from the source to destination. The Move command can move single or multiple files or directories from source but the destination should be only one path or file. It also gives a prompt before we overwrite and it also gives an option to move only the new files in the destination. In this Topic, we are going to learn about Linux Move Folder and we will show you how to use the Linux Move command with its options. Each option is explained briefly with syntax and screenshots for better understanding.

Syntax of Linux Move Folder:

Start Your Free Software Development Course

Web development, programming languages, Software testing & others

Below are different syntax which can be used as per the requirement to move folders from source to destination in Linux.

mv source target

mv folder1 folder2 target

mv file folder target

mv -options source target

The Move ‘mv’ command can move single or multiple files or directories from source but the destination should be only one path or file. It also gives a prompt before we overwrite and it also gives an option to move only the new files in the destination.

How to move a folder in Linux?

Below are the options that can be used with mv command in Linux.

Options Descriptions
–backup[=CONTROL] Helps to make a backup of each existing destination file in the server
 -b It is similar to –backup option but it does not keep an argument
-f, –force It will not prompt any option before overwriting
-i, –interactive It will prompt options before we overwrite.
-n, –no-clobber It does not overwrite an existing file
–strip-trailing-slashes This option will remove any trailing slashes from each of the SOURCE argument
-S, –suffix=SUFFIX It overrides the general backup suffix
-t, –target-directory=DIRECTORY moves all the SOURCE arguments into the target DIRECTORY
-T, –no-target-directory It treats the target DESTINATION as a casual file
-u, –update It will allow us to move only when the SOURCE file or directory is newer than the target-directory or file or if the destination file is not present.
-v, –verbose It explains what is going to be done
–help It will display all the options using the help option and will exit
–version It displays the output version information and exits

Examples of Linux Move Folders

Here are the options listed below on how to use move commands when options are passed through it.

Example #1 – No Option

When the move command is used without passing any options, then it will directly overwrite the folder. Syntax and example are given below for better understanding.

Popular Course in this category
Kali Linux Training (3 Courses, 3+ Projects)3 Online Courses | 3 Hands-on Projects | 21+ Hours | Verifiable Certificate of Completion | Lifetime Access
4.5 (5,486 ratings)
Course Price

View Course

Related Courses
Linux Training Program (16 Courses, 3+ Projects)Red Hat Linux Training Program (4 Courses, 1+ Projects)

Syntax:

mv folder1 folder2

Example:

mv fruits vegetables
ls

Output:

Linux Move Folder Example 1

Example #2 – Option -i

By default, move command does not prompt when the folders are overwriting an existing folder. The above screenshot shows that the folder is overwritten without any prompt or warning. But if we want any warnings to be prompted, we can use option ‘-i’.

Syntax:

mv -i folder1 folder2

Example:

mv -i fruits.txt vegetables.txt

Output:

Linux Move Folder Example 2

Example #3 – Option -f

When we want to explicitly mention that we do not want to prompt any warnings while overwriting a folder, then we can use option -f.

Syntax:

mv -f folder1 folder2

Example:

mv -f fruits.txt vegetables.txt

Output:

Linux Move Folder Example 3

Example #4 – Option -n

If we do not want to overwrite an existing file, we can use option -n. this will not allow us to overwrite an existing file when we use the move command line.

Syntax:

mv -n folder1 new_folder

Example:

mv -n vegetables.txt apple.txt
ls

Output:

Linux Move Folder Example 4

Example #5 – Option -b

This option is used when we want to take a backup of the existing destination folder. The option -b will create a backup folder of the destination folder with a tilde(~) appended to it.

Syntax:

mv -b folder1 folder2

Example:

mv -b folder1 folder2
ls

Output:

Option -b Example 5

Example #6 – Option -v

When we want to see what is happening explicitly when we use mv command, we can use -v option to be passed through mv command.

Syntax:

mv -v source destination

Example:

mv -v folder1 folder2

Output:

Option -v Example 6

Conclusion

The move command is a very useful and easy command line command in Linux to move files or folders from source to destination. It is also used to rename files or folders in the system. The Move command can move single or multiple files or directories from source but the destination should be only one path or file. It also gives a prompt before we overwrite and it also gives an option to move only the new files in the destination.

Thus, from the above article, you have learned how to use move command in Linux. Options that can be passed through move command is also explained above with syntax and screenshots for better understanding. Hope you are now familiar with how to move folders in Linux.

Recommended Articles

This is a guide to Linux Move Folder. Here we discuss how to use move commands to move folder when options are passed through it along with examples. You may also have a look at the following articles to learn more –

  1. FTP Server in Linux
  2. chmod Command in Linux
  3. Chown Command in Linux
  4. Copy Command in Linux

All in One Software Development Bundle (600+ Courses, 50+ projects)

600+ Online Courses

50+ projects

3000+ Hours

Verifiable Certificates

Lifetime Access

Learn More

0 Shares
Share
Tweet
Share
Primary Sidebar
Linux Tutorial
  • Advanced
    • Install VMware
    • Install GRUB
    • Chown Command in Linux
    • Linux Network Command
    • Configuring Linux Network Environment
    • DNS Configuration in Linux
    • Linux Users
    • Create User in Linux
    • DHCP Server in Linux
    • FTP Server in Linux
    • Linux Regular Expression
    • IP Command in Linux
    • Set IP Address in Linux
    • Tar Command in Linux
    • Dynamic Host Configuration Protocol
    • Linux Kill Signals
    • Linux File Permissions
    • Linux File System
    • Linux Create File
    • Linux Concatenate Files
    • Linux Join
    • Linux Process Management
    • Linux Proxy Server
    • Linux System Commands
    • Linux System Logging
    • NFS in Linux
    • Linux LVM
    • Linux Repository
    • Samba Server in Linux
    • Top Commands in Linux
    • Types of Shells in Linux
    • Shell Script Types For Linux
    • GCC Command in Linux
    • Monolithic Kernel
    • YARN Package Manager
    • Linux Sed Replace
    • Linux List Groups
    • Linux Container
    • Linux Find File by Name
    • Create Folder in Linux
    • Linux Move Folder
    • Linux Error Codes
    • Linux Automount
    • Linux HugePages
  • Basic
    • Introduction to Linux
    • What is Linux
    • Careers in Linux
    • How to Install Linux
    • How to Install Ubuntu
    • How to Install Ubuntu Server
    • How To Install Debian
    • Advantage Of Linux
    • What is Raid in Linux
    • What is Raid 5?
    • Raid 5 vs Raid 6
    • Careers in Linux Administration
    • What is Shell in Linux?
    • Bash Shell in Linux
    • Linux Emulator
    • Linux Operators
    • Linux Apps
    • Linux Keyboard Shortcuts
    • Linux Crontab
    • What is Raid Storage
    • What is Vmware
    • What is RedHat
    • What is Debian
    • Uses of Ubuntu
    • Career In RedHat
    • Linux Distributions
    • Linux From Scratch
    • Linux Format
    • Cheat Sheet Linux
  • Linux Commands
    • CAT Command in Linux
    • PS command in Linux
    • Mkdir Command in Linux
    • rmdir command in Linux
    • mv command in Linux
    • Linux rm Command
    • CHMOD Command in Linux
    • Zip Command in Linux
    • Linux Route Command
    • SCP Command in Linux
    • du Command in Linux
    • Less Command in Linux
    • Copy Command in Linux
    • Head Command in Linux
    • Help Command in Linux
    • Linux History Command
    • hostname Command in Linux
    • GREP Command in Linux
    • Linux Curl Command
    • Linux List Users
    • Linux List Directories
    • Linux Directory Permissions
    • Find Directory Linux
    • Linux User Permission
    • Linux Add User
    • Linux Delete User
    • Linux uniq
    • Linux Filter Commands
    • Linux sort Command
    • Linux Sort by Size
    • Remove dir Linux
    • Linux tr Command
    • Linux Touch Command
    • Linux More Command
    • Linux Cal Command
    • Linux OD
    • Linux Zcat
    • Linux tracepath
    • Linux Sleep
    • Linux bg Command
    • Linux WC
    • Linux Read
    • Linux Write
    • Linux Rename Command
    • Linux Free Command
    • Linux tac
    • Linux Shred
    • Linux wget
    • Linux Date
    • Linux Untar
    • Linux JQ
    • Linux Xargs
    • Linux Mount Command
    • Linux mdadm
    • Linux comm
    • Linux tee Command
    • Tail Command in Linux
    • Linux gzip
    • Linux Directory Structure
    • Linux Alias Command
    • Linux Inode
    • Linux Ping
    • Linux Watch Command
    • Linux Split Command
    • Linux Size
    • Linux Network Stack
    • Linux Diff Command
    • Vim Command in Linux
    • Linux nslookup
  • Kali Linux
    • Install Kali Linux
    • Kali Linux Uses
    • Kali Linux Commands
    • Kali Linux Repository
    • Kali Linux Packages
    • Kali Linux root password
    • Kali Linux Alternative
  • Interview Questions
    • Linux Interview Questions
    • Linux System Administration Interview
    • Red Hat Interview Questions

Related Courses

Kali Linux Training

Linux Training Course

Red Hat Training Course

Footer
About Us
  • Blog
  • Who is EDUCBA?
  • Sign Up
  • Corporate Training
  • Certificate from Top Institutions
  • Contact Us
  • Verifiable Certificate
  • Reviews
  • Terms and Conditions
  • Privacy Policy
  •  
Apps
  • iPhone & iPad
  • Android
Resources
  • Free Courses
  • Java Tutorials
  • Python Tutorials
  • All Tutorials
Certification Courses
  • All Courses
  • Software Development Course - All in One Bundle
  • Become a Python Developer
  • Java Course
  • Become a Selenium Automation Tester
  • Become an IoT Developer
  • ASP.NET Course
  • VB.NET Course
  • PHP Course

© 2020 - EDUCBA. ALL RIGHTS RESERVED. THE CERTIFICATION NAMES ARE THE TRADEMARKS OF THEIR RESPECTIVE OWNERS.

EDUCBA Login

Forgot Password?

EDUCBA
Free Software Development Course

Web development, programming languages, Software testing & others

*Please provide your correct email id. Login details for this Free course will be emailed to you
Book Your One Instructor : One Learner Free Class

Let’s Get Started

This website or its third-party tools use cookies, which are necessary to its functioning and required to achieve the purposes illustrated in the cookie policy. By closing this banner, scrolling this page, clicking a link or continuing to browse otherwise, you agree to our Privacy Policy

EDUCBA

*Please provide your correct email id. Login details for this Free course will be emailed to you
EDUCBA
Free Software Development Course

Web development, programming languages, Software testing & others

*Please provide your correct email id. Login details for this Free course will be emailed to you

Special Offer - Kali Linux Training Learn More