Technoracle
    Facebook Twitter Instagram
    • Sitemap
    • Privacy Policy
    • Disclaimer
    • Term of Services
    Facebook Twitter Instagram Pinterest Vimeo
    TechnoracleTechnoracle
    • Tutorials
      • Amazon Cloud
      • Google Cloud
    • How To
    • Blog
    • About
    Subscribe
    Technoracle
    Home»How To»How to Rename a Directory in Linux [3 Easy Methods]
    How To

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

    Rajesh ShivamBy Rajesh ShivamJune 6, 2021No Comments2 Mins Read
    Share Facebook Twitter Pinterest LinkedIn Tumblr Reddit Telegram Email
    Rename a Directory in Linux
    Share
    Facebook Twitter LinkedIn Pinterest Email
    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
    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

    Hello, everyone, I am Rajesh Shivam, I am a full-time freelancer with more than seven years plus experience in different freelancing platforms, in this blog, I am going to provide complete freelancing tips and tricks.

    Related Posts

    How To

    How to Install Microsoft Teams on Ubuntu 22.04 Easily

    February 22, 2023
    Read More
    How To

    What is Elastic IP and Its Pricing in AWS

    February 22, 2023
    Read More
    How To

    How to Convert PEM to PPK file [Step by Step Guide]

    February 22, 2023
    Read More
    Add A Comment

    Leave A Reply Cancel Reply

    Facebook Twitter Instagram Pinterest
    © 2023 Technoracle

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

    Go to mobile version