The effortless way to transfer files and folders (directories) is through the “mv” command. This built-in command is a multi-tasking command that is also used to rename files as well.
Move Files and Directories in Linux Using mv Command
Let’s divide this article into two portions;
First portion will cover how to move files and other will cover how to move directories:
The syntax of mv command is:
Moving files can be done using two ways:
Let’s check how we can do it:
1. How to Move File in Linux using Terminal
There is a testing file in my system named “sample.txt” in the system, we will use this to perform mv commands.
(If you want to create a new file, use “touch” command; i-e, touch sample.txt, it will create a new file in system)
Now, run the following command to move “sample.txt” in the Documents directory:
To confirm whether command works or not, type:
It might be confusing for beginners about giving correct source and destination path, you can check it through following way:
Right click on the required file or folder and click on “Properties” from pop-up menu:
You will get path there:
2. How to Move File in Linux using GUI
The files folder is located at the left corner on screen. If you don’t get it, go to the application manager and type “files” or “nautilus” in the search bar. You will get files option, select it to reveals are files present on system:
Navigate towards required folder you want to move, let’s suppose to move “testing.txt” file, right-click on it and navigate towards “cut” option:
Go back to the home directory and select the folder where you want to move the cut file, right click there, and hit to Paste option:
Your file will move successfully:
Conclusion
Moving files and directory is the most useful task while working with the system. In Linux, users can move files and folders through the built-in mv command which is easy to perform. This article has covered the ways to transfer files and folders in the Linux system. We performed it using two ways; i-e through terminal and GUI.