Technoracle
    Facebook Twitter Instagram
    Facebook Twitter Instagram
    TechnoracleTechnoracle
    • Home
    • AWS
      • EC2
      • Lightsail
      • RDS
      • S3
    • Ubuntu
      • Ubuntu 20.04
      • Ubuntu 22.04
    • AI Tools
    • Web Hosting
    • WordPress
    • Tech News
    Technoracle
    Home - How to Rename a Directory in Linux [3 Easy Methods]
    Uncategorized

    How to Rename a Directory in Linux [3 Easy Methods]

    Rajesh ShivamBy Rajesh ShivamJune 6, 2021No Comments2 Mins Read
    Rename a Directory in Linux
    Rename a Directory in Linux

    Renaming directories in Linux systems is one of the basic operations every user performs. To rename a file or directories, you need to use the “mv” command from the terminal. Alternatively, you can rename by right-clicking the file or directories. In this tutorial, I am going to explain how to rename a directory in Linux operating systems using the command line. So let’s get started.

    Page Contents

    • How to Rename a Directory in Linux
      • Rename directories using mv command
      • Rename Directories using Find Command.
      • Rename Directories using Rename Command.
    • Conclusion

    How to Rename a Directory in Linux

    1. Rename directories using mv command.
    2. Rename directories using find command.
    3. Rename directories using rename command.

    Let’s discuss all the method one by one

    Rename directories using mv command

    You can use mv command to rename a directory in Linux. For example, if you want to rename the directory “Linux” to “Linux_LTS”, run the following command to perform the operation.

    $ sudo mv Linux Linux_LTS

    *If you are not root user, you have use sudo.

    If you want to rename a directory from a different location. Let’s consider you are renaming the directory from the apache document root and you are running the command on home directory. In that case, you have to use full path from the root (absolute path) in the command to rename directory.

    $ sudo mv /var/www/html/example_directory /var/www/html/example_directory_renamed

    Rename Directories using Find Command.

    Sometimes we need to use find command to locate the directory to perform some sort of operations. You can use find command to rename a folder in Linux. For example,

    $ find . -depth -type d -name Linux -execdir mv {} Linux_1 \;

    The above will first find the directory “Linux” and then rename it to “Linux_1” using mv command.

    Rename Directories using Rename Command.

    Apart from mv command, you can use rename command to rename your files and directories.

    $ rename Linux_1 Linux_2
    rename a directory in Linux

    By default, the rename command not installed in your Linux system. To use rename command first you have to install using apt.

    $ sudo apt install rename

    Now, you can rename any directories using rename command.

    You can also check out How to Copy Files and Directories in Linux

    Conclusion

    In this article, you have learned how to rename a directory in Linux operating systems. If you have any doubts feel free to contact me, I will definitely try to help you. Also, you can join our elite Facebook group to get direct help from me. If you like this tutorial, please share this article on your social media handle.

    linux file name change ubuntu tips
    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email Reddit
    Previous ArticleHow to Install Zabbix Agent on Ubuntu 20.04 Easily
    Next Article How to Install AWS CLI on Ubuntu 20.04 Easily
    Rajesh Shivam
    • LinkedIn

    Rajesh Shivam is a seasoned professional with expertise in AWS and Linux System Administration. With over 10 years of freelancing experience, he brings a wealth of knowledge to the table. Rajesh has a strong passion for technology and stays connected with the latest happenings in the field. His dedication and expertise make him a trusted resource for all things tech-related.

    Related Posts

    Install PHP on Ubuntu 22.04
    Ubuntu

    How to Install PHP on Ubuntu 22.04 [Simple Guide]

    Read More
    Uncategorized

    How to Get your First Order On Fiverr in 2023 – 5 Proven tricks

    Read More
    Install Microsoft Teams on Ubuntu 22.04
    Ubuntu

    How to Install Microsoft Teams on Ubuntu 22.04 (Easy Steps)

    Read More
    Add A Comment

    Leave A Reply Cancel Reply

    Install Google Chrome on Ubuntu 22.04

    How to Install Google Chrome on Ubuntu 22.04(Easy Guide)

    August 29, 2023
    Enable PHP BCMath Extension in cPanel

    How to Enable PHP BCMath Extension in cPanel (3 Easy Quick Steps)

    August 25, 2023
    install PHP GD on Ubuntu

    How to Install PHP GD on Ubuntu 22.04 [Easy Guide]

    May 2, 2023
    Install PHP on Ubuntu 22.04

    How to Install PHP on Ubuntu 22.04 [Simple Guide]

    April 26, 2023

    Subscribe to Blog

    Enter your email address to subscribe to
    this blog and receive notifications of new posts by email.

    Facebook Twitter Instagram Pinterest
    • Sitemap
    • Privacy Policy
    • Disclaimer
    • Term of Services
    © 2023 Technoracle

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

    Click to Copy
    Go to mobile version