How to move files in linux

Content on WhatAnswers is provided "as is" for informational purposes. While we strive for accuracy, we make no guarantees. Content is AI-assisted and should not be used as professional advice.

Last updated: April 4, 2026

Quick Answer: In Linux, you can move files using the `mv` command in the terminal, specifying the source file(s) and the destination directory. Alternatively, graphical file managers like Nautilus or Dolphin allow you to drag and drop files between folders, similar to other operating systems.

Key Facts

Overview

Moving files is a fundamental operation in any operating system, and Linux offers versatile ways to accomplish this task, catering to both command-line enthusiasts and users who prefer a graphical interface. Whether you need to organize your documents, relocate program data, or simply tidy up your directories, understanding how to move files efficiently in Linux is essential.

Command-Line Method: The `mv` Command

The most common and powerful way to move files in Linux is through the command line, using the `mv` (move) command. This command is incredibly versatile and can be used for moving files, renaming files, and even moving directories.

Basic Syntax of `mv`

The general syntax for the `mv` command is:

mv [options] source destination

Where:

Examples of Using `mv`

1. Moving a single file to another directory:

mv mydocument.txt /home/user/documents/

This command moves the file `mydocument.txt` from the current directory to the `/home/user/documents/` directory.

2. Moving multiple files to a directory:

mv file1.txt file2.jpg image.png /home/user/backup/

This moves `file1.txt`, `file2.jpg`, and `image.png` into the `/home/user/backup/` directory.

3. Moving a directory:

mv myproject /opt/projects/

This moves the entire `myproject` directory and its contents to the `/opt/projects/` directory.

4. Renaming a file:

mv oldname.txt newname.txt

This command renames `oldname.txt` to `newname.txt` in the current directory. It doesn't actually move the file's location, but rather changes its name.

5. Renaming a directory:

mv old_dir new_dir

Similar to renaming a file, this renames the directory `old_dir` to `new_dir`.

Useful `mv` Options

For instance, to move a file verbosely and be prompted if a file already exists:

mv -iv mydocument.txt /home/user/documents/

Graphical File Manager Method

For users who prefer a visual approach, Linux desktop environments provide graphical file managers. Popular examples include Nautilus (used in GNOME), Dolphin (used in KDE), Thunar (used in XFCE), and PCManFM (used in LXDE).

Using Drag and Drop

The process is very similar to how you would move files in Windows or macOS:

  1. Open your file manager.
  2. Navigate to the directory containing the file(s) or folder(s) you want to move.
  3. Open another file manager window or tab and navigate to the destination directory.
  4. Click and hold the left mouse button on the file(s) or folder(s) you want to move.
  5. Drag the selected item(s) to the destination directory window.
  6. Release the mouse button.

Most file managers will prompt you if you are about to overwrite an existing file. You can usually confirm or cancel the operation at this point.

Using Copy and Paste (or Cut and Paste)

You can also use the copy/paste or cut/paste functionality:

  1. Select the file(s) or folder(s) you want to move.
  2. Right-click on the selection and choose 'Cut' (or press Ctrl+X).
  3. Navigate to the destination directory.
  4. Right-click in an empty space within the destination directory and choose 'Paste' (or press Ctrl+V).

Using 'Cut' effectively moves the files after they are pasted. If you were to 'Copy' (Ctrl+C) and then 'Paste' (Ctrl+V), it would duplicate the files, leaving the originals in place.

Moving Files Between Different Filesystems

When you move a file within the same filesystem (e.g., from one directory to another on your main hard drive partition), the operation is extremely fast. This is because Linux doesn't actually copy the data; it simply updates the file's metadata (the directory entry) to point to the new location. This is a metadata operation, not a data transfer.

However, when you move a file between different filesystems (e.g., from your internal hard drive to a USB drive, or from one partition to another), Linux performs a copy operation followed by a delete operation. This means the data is actually transferred, and it will take longer depending on the file size and the speed of the storage devices involved.

Permissions and Ownership

When moving files, their ownership and permissions generally remain the same. The `mv` command does not change the owner or group of a file unless you are root (the administrator) and explicitly tell it to do so. Similarly, graphical file managers typically preserve these attributes.

Conclusion

Both the command-line `mv` command and the graphical file manager's drag-and-drop or cut-and-paste functions are effective ways to move files in Linux. The choice often depends on personal preference, the complexity of the task, and whether you are working in a terminal or a desktop environment. Understanding the nuances, especially regarding operations across different filesystems, will help you manage your files more efficiently.

Sources

  1. mv(1) - Linux man pageCC0-1.0
  2. Command line tools: move files - Ubuntu Tutorialsfair-use
  3. Coreutils: mv invocationGPL-3.0-or-later

Missing an answer?

Suggest a question and we'll generate an answer for it.