Anjan Dutta
Move files from one directory to another in Linux
Move files from one directory to another in Linux
To move files and directories in Linux we use the mv
command.
Before running the command, you must know the working directory from where you are running the command. And, the relative path to the target and destination files.
Below is the command to copy files from one directory to another:
mv /directory_name/file_name.txt /new_directory_name
Let's take a look at the below example:
I have created 2 directories, directory1
and directory2
.
directory1
contains a file named my_file.txt
The below image shows how we can copy my_file.txt
from directory1
to directory2
.
Next, I am showing how you can specify the path to move a file from your working directory to an outside directory.
Hope this article will help you to understand the Linux move command. Thanks for reading.