Close Menu
    Facebook X (Twitter) Instagram
    Command Linux
    • About
    • How to
      • Q&A
    • OS
      • Windows
      • Arch Linux
    • AI
    • Gaming
      • Easter Eggs
    • Statistics
    • Blog
      • Featured
    • MORE
      • IP Address
      • Man Pages
    • Write For Us
    • Contact
    Command Linux
    Home - How to - How To Use Linux Move Directory Command

    How To Use Linux Move Directory Command

    WillieBy WillieJanuary 6, 2026Updated:January 6, 2026No Comments4 Mins Read

    Managing files and directories is a fundamental task in Linux. The mv command lets you move directories efficiently using the terminal or GUI.

    This guide covers both methods to move directories in Linux.

    Prerequisites:

    • A system running Linux
    • Access to the terminal
    • Basic command-line knowledge

    How to Use mv Command to Move Directories

    The mv command moves files and directories between locations. Use this syntax:

    mv [options] [source] [destination]

    Move the Projects directory to Documents:

    mv Projects Documents

    The command executes silently. No output means success.

    Move multiple directories by listing them before the destination:

    mv [source1] [source2] [source3] [destination]

    Move three directories to Archive:

    mv Projects Reports Notes Archive
    Note: The destination must exist. If it doesn’t, mv renames the source to the destination name instead.

    Rename a directory by providing a new name:

    mv [old_name] [new_name]

    Rename Projects to WorkFiles:

    mv Projects WorkFiles

    mv Command Options

    The mv command accepts several options:

    Option Purpose
    -b Create backup of destination files
    -f Force overwrite without prompts
    -i Ask before overwriting files
    -n Never overwrite existing files
    -u Update only newer files
    -v Show detailed output
    -t Specify target directory
    -S Set backup file suffix

    Create a backup before overwriting:

    mv -b notes.txt Documents

    The backup file adds a tilde suffix: notes.txt~.

    Change the backup suffix:

    mv --backup -S .bak notes.txt Documents

    The backup becomes notes.txt.bak.

    Request confirmation before replacing files:

    mv -i data Documents

    Type y to proceed or n to cancel.

    View each action as it happens:

    mv -v Projects Archive

    Output shows: renamed 'Projects' -> 'Archive/Projects'

    Warning: Moving directories to /dev/null deletes them permanently. Double-check paths before executing commands.

    Force overwrite with -f. Prevent overwriting with -n. Update only newer content with -u.

    Tip: Combine -i and -v for safe, visible operations: mv -iv source destination

    How to Move Directories Using GUI

    Linux file managers provide graphical options. The process varies slightly by desktop environment but follows similar steps.

    Method 1: Cut and Paste

    Select the directory. Press Ctrl+X or right-click and choose Cut.

    Navigate to the destination. Press Ctrl+V or right-click and select Paste.

    The directory moves with all contents and subdirectories.

    Method 2: Move To Option

    Right-click the directory. Select Move to… from the menu.

    Browse to the destination folder. Click Select to complete the move.

    Popular file managers include Nautilus for GNOME, Dolphin for KDE, and Thunar for Xfce. Each offers similar functionality.

    Note: GUI methods work identically to command-line operations. Both preserve directory structure and permissions.

    Conclusion

    Moving directories in Linux works through command line or GUI. The mv command offers precise control and options. File managers provide intuitive visual methods.

    Master both approaches for efficient file management. Choose the method that suits your workflow.

    FAQs

    Use the command mv source_directory destination_directory. The directory moves with all its contents to the new location without creating copies.

    The source directory moves inside the existing destination directory. If a directory with the same name exists there, it may be overwritten or merged depending on options used.

    Yes, list all source directories before the destination: mv dir1 dir2 dir3 destination. The last argument becomes the target location for all preceding directories.

    Use mv -n source destination to skip existing files. Alternatively, use mv -i source destination to get confirmation prompts before overwriting any files.

    Yes, the mv command preserves all file permissions, ownership, and timestamps. The directory structure and all attributes remain unchanged after moving to the new location.

    Willie
    • Website

    Willie has over 15 years of experience in Linux system administration and DevOps. After managing infrastructure for startups and enterprises alike, he founded Command Linux to share the practical knowledge he wished he had when starting out. He oversees content strategy and contributes guides on server management, automation, and security.

    Related Posts

    How to Prepare a Linux Mint Live USB

    April 17, 2026

    How To Take Screenshot on Linux

    April 15, 2026

    How to Use the Linux Restart Command to Reboot Your Server

    April 15, 2026

    How To Run A Shell Script In Linux

    April 13, 2026
    Top Posts

    What Does zavalio com Offer?

    April 6, 2026

    ROUTE

    March 17, 2026

    SYSTEMD-TIMESYNCD.SERVICE

    March 4, 2026

    SLEEP

    April 7, 2026
    • Home
    • Contact Us
    • Privacy Policy
    • Terms of Use

    Type above and press Enter to search. Press Esc to cancel.