Almost all Linux distributions allow us to create, delete, and move files. One of the most frequent tasks while using Linux is moving files and folders from one place to another

This guide will demonstrate how to move files to other folders in Linux using the command line terminal and GUI.

How do I move a file to another folder in Linux?

To move a single file or multiple files to another folder or simply change the directory of a file, two methods are frequently used.

  • Using Command-Line
  • Using GUI

Let’s discuss them one by one.

Method 1: Move a File to Another Folder in Linux Using Command Line

To change the directory of a file, we can use the mv command. This command changes the location of the file to the specified directory etc.

The syntax of the mv command is demonstrated below:

$ mv file.txt dir

For instance, we can see that the sample.txt file is present in the home directory

It can be seen that the directory of the file is changed from Home to Home/Documents.

Let’s change the location of multiple files using the mv command.

The syntax is as follows:

$ mv file1 file2 dir

We can see that the two files named file1.txt and file2.txt are in the home directory. Let’s move them into the samples directory

It can be seen that the location of the files has been changed successfully.

Method 2: Move a File to Another Folder in Linux Using GUI

A simple and most commonly used method to change the location of files and directories is the GUI (Graphical User Interface) method.

Let’s demonstrate this method with the help of an example:

We can see that the workfile.txt is currently in the home directory. Let’s change its location.

Right-click on the file and select Move to Button.

Now choose the folder where you want to locate your file. In our case, it’s the Samples folder.

It can be seen that the directory of the workfile.txt is changed from Home to Home/Samples.

Conclusion

To locate a single file or multiple files to other folders in Linux, two methods are frequently used such as the Command line method and the GUI method. In the command line, use the mv file.txt dir command to change the location of a single file. In the GUI method, simply right-click the file that you want to move, select Move to, and simply select the folder where you want to locate your file. This write-up has illustrated how to move files to other folders in Linux using the command line terminal and GUI.