TestingDocs.com
    Software Testing website
    • Automation
      • Selenium
      • JBehave Framework
    • Tutorials
      • MySQL Tutorials
      • Testlink
      • Maven
      • Git
    • IDEs
      • IntelliJ IDEA
      • Eclipse
    • Flowcharts
      • Flowgorithm
      • Raptor
    • About

    Linux commands

    rmdir Linux command

    Overview

    In this tutorial, we will learn about rmdir Linux Command with examples.

    rmdir Linux Command

    rmdir is the short form for ‘remove directory’. The rmdir command deletes the specified directory from the Linux file system. The specified directory should be empty for the command to work.

    Command Format

    The command format is as follows:

    $ rmdir <flags> directory_list

    To know more about the command, type the man command

    $ man rmdir

    The directory_list is one or more directory paths of empty directories that rmdir deletes from the system.

    Examples

    Launch the Terminal and type the following commands.

    Remove empty directory

    For example, to remove directory automation:

    $ rmdir automation

    rmdir Linux command

    The command fails to remove a non-empty directory.

    Create a directory and create a file in the directory.
    Try to remove the non-empty directory with the rmdir command.

    rmdir directory not empty

     

    testingdocs@ubuntu:~$ mkdir automation
    testingdocs@ubuntu:~$ cd automation/
    testingdocs@ubuntu:~/automation$ touch sample.txt
    testingdocs@ubuntu:~/automation$ cd ..
    testingdocs@ubuntu:~$ rmdir automation/
    rmdir: failed to remove ‘automation/’: Directory not empty

    We will learn how to overcome this issue with the rm command.

    rm command

    https://www.testingdocs.com/rm-linux-command-with-examples/

    We can remove multiple empty directories with the rmdir command. For example, to remove two empty directories:

    $ rmdir emptydir1 emptydir2

    –

    Linux Commands Tutorial page:

    https://www.testingdocs.com/linux-basic-commands-tutorial/

    More Information on Ubuntu Linux:
    https://ubuntu.com/

    Related Posts

    sudo auth log entry

    Linux commands /

    sudo Linux Command with Examples

    Common File Commands in Linux

    Linux commands /

    Common File Commands in Linux

    su linux command

    Linux commands /

    su Linux Command

    ls linux command

    Linux commands /

    ls Linux Command with Examples

    touch create file

    Linux commands /

    touch Linux Command

    ‹ man Linux command› pwd Linux command

    Recent Posts

    • ChatGPT Subscription Plans
    • Stellar Converter for Database
    • Stellar Log Analyzer for MySQL
    • Stellar Repair for MySQL
    • ChatGPT Capabilities
    • How to secure your SQL Database: Tips and Tricks
    • ChatGPT4 Conversational AI Features
    • Shaping the Future of Development: Exploring Key Trends in Software Engineering
    • Improving Java Performance with Multithreading
    • Open-source Vector Databases

    Back to Top

    Links

    • Contact
    • Privacy Policy
    • Cookie Policy

    www.TestingDocs.com