How to move folder 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
Key Facts
- The `mv` command is used for both moving and renaming files/directories in Linux.
- Moving a folder within the same filesystem is a very fast operation, as only the pointer is updated.
- Moving a folder across different filesystems requires copying and then deleting the original.
- Graphical File Managers offer a visual drag-and-drop interface for moving folders.
- Permissions and ownership are generally preserved when moving folders.
Overview
Moving a folder, also known as a directory, in Linux is a fundamental operation for organizing your files. Whether you're using the command line or a graphical interface, Linux provides straightforward methods to relocate directories and their contents. Understanding how to move folders efficiently is crucial for maintaining a tidy and accessible file system.
Using the Command Line: The `mv` Command
The most common and powerful way to move folders in Linux is through the terminal using the `mv` command. The `mv` command is a versatile utility that stands for 'move'. It's primarily used for two purposes: moving files and directories from one location to another, and renaming them.
Basic Syntax
The general syntax for moving a directory is:
mv [options] source_directory destination_directory- source_directory: This is the path to the folder you want to move.
- destination_directory: This is the path where you want to move the folder.
Examples:
1. Moving a folder to another directory:
Suppose you have a folder named `documents` in your home directory (`~/`) and you want to move it into a folder named `backup` which is also in your home directory. You would use the following command:
mv ~/documents ~/backup/After this command, the `documents` folder will no longer be in your home directory; it will be located inside the `backup` folder.
2. Moving and renaming a folder simultaneously:
The `mv` command can also rename a folder as you move it. If you want to move the `documents` folder from your home directory to the `backup` directory and rename it to `old_docs` in the process, you would do:
mv ~/documents ~/backup/old_docsThis command moves the `documents` folder into `backup` and renames it to `old_docs`.
3. Moving a folder to the current directory:
If you are currently in the `backup` directory and want to move a folder named `reports` from a parent directory (`../`) into your current location, you can use:
mv ../reports .The `.` symbol represents the current directory.
Important Considerations with `mv`
- Permissions: By default, `mv` preserves the ownership and permissions of the moved directory and its contents.
- Overwriting: If a file or directory with the same name already exists in the destination, `mv` might overwrite it depending on the options used and the system's configuration. Use the `-i` (interactive) option to be prompted before overwriting, or `-n` (no-clobber) to prevent overwriting.
- Moving Across Filesystems: When you move a folder to a different partition or disk (i.e., a different filesystem), `mv` performs a copy operation followed by a delete operation. This can take longer than moving within the same filesystem, as the data actually needs to be read and written. If the copy fails partway, the original might still exist.
Using Graphical File Managers
For users who prefer a visual approach, Linux desktop environments come with graphical file managers. Popular examples include Nautilus (GNOME), Dolphin (KDE), Thunar (XFCE), and Caja (MATE).
Drag and Drop
The most intuitive method is using the drag-and-drop functionality:
- Open two file manager windows.
- In the first window, navigate to the folder you want to move.
- In the second window, navigate to the destination directory where you want the folder to end up.
- Click and hold the left mouse button on the folder you wish to move.
- Drag the folder from the source window to the destination window.
- Release the mouse button.
Most file managers will move the folder. Sometimes, especially when dragging between different drives or partitions, you might be prompted if you want to move or copy. Holding down modifier keys like `Shift` might force a move, while `Ctrl` might force a copy, but this behavior can vary.
Cut and Paste
You can also use the traditional cut and paste method:
- Right-click on the folder you want to move and select 'Cut' (or use the keyboard shortcut, often `Ctrl+X`).
- Navigate to the destination directory.
- Right-click in an empty space within the destination directory and select 'Paste' (or use the keyboard shortcut, often `Ctrl+V`).
The folder will be moved from its original location to the new one.
Choosing the Right Method
The choice between the command line and a graphical file manager often comes down to personal preference and the specific task:
- Command Line (`mv`): Ideal for scripting, automation, remote server management (via SSH), and for users who are comfortable with terminal operations. It's generally faster and more efficient for complex operations or when dealing with many files.
- Graphical File Manager: More intuitive for beginners and visually oriented users. It's excellent for simple, everyday file organization tasks on a desktop environment.
Both methods achieve the same result: relocating your folders. Understanding both will make you a more proficient Linux user.
More How To in Daily Life
Also in Daily Life
More "How To" Questions
Trending on WhatAnswers
Browse by Topic
Browse by Question Type
Sources
- mv(1) - Linux man pageCC0-1.0
- Moving files and directories - Ubuntu Tutorialsfair-use
- Moving and renaming files - GNU Coreutils ManualGPL-3.0-or-later
Missing an answer?
Suggest a question and we'll generate an answer for it.