Cheatsheets
HomeWriteupsResourcesCheatsheets
Linux
Linux
  • Know Yourself and Your System
    • id
    • logname
    • uname
    • w
    • who
    • whoami
  • Surfing / Knowing Your File System
    • cd
    • df
    • du
    • ls
    • pwd
    • stat
    • tree
  • Knowing About Files / Commands
    • alias
    • file
    • info
    • whatis
    • apropos
    • man
    • help
    • history
    • script
  • Manipulating Files / Directories
    • touch
    • mkdir
    • rm
    • rmdir
    • cp
    • mv
    • ln
  • Interacting with Files
    • cat
    • head
    • less
    • middle
    • more
    • tail
  • STROPS / Text Manipulation
    • awk
    • cut
    • grep
    • jq
    • join
    • paste
    • sed
    • sort
    • tr
    • uniq
    • xargs
    • xclip
    • wc
    • tee
    • echo
    • comm
    • diff
    • patch
    • aspell
    • Combos
  • Formatting the Output
    • nl
    • fold
    • fmt
    • pr
    • printf
  • Searching / Finding
    • find
    • locate
    • which
    • whereis
    • type
  • Web Interaction
    • curl
    • wget
  • xxd
  • References
Powered by GitBook
On this page
  • Introduction
  • Syntax
  • Important Flags
  • Examples

Was this helpful?

  1. Manipulating Files / Directories

rmdir

rmdir linux command cheatsheet by Thamizhiniyan C S

Introduction

This command is used to remove the DIRECTORY(ies), if they are empty.


Syntax

rmdir [OPTION]... DIRECTORY...


Important Flags

Flag
Description

--ignore-fail-on-non-empty

Doesn't show an error message when trying to remove a non-empty directory.

-p

Removes the directory along with its parent in the hierarchy.

-v

Provides a verbose output.

--help

Displays help text.

--version

Displays the command version.


Examples

Command
Description

Removes multiple directories using the basic rmdir command.

Removes the LINUX, INFO, and DETAIL directories.

Deletes a directory, including all subdirectories.

Deletes the LINUX directory, including all its ancestors.

Removes a subdirectory and its hierarchical parent and lists each step of the process.

Displays a message after removing the specified directories.

Deletes the LINUX, INFO, and DETAIL directories and displays a message after each removal.

Deletes all directories that contain "LINUX" in their name and displays a message after each removal.

Removes multiple directories in reverse order of hierarchy and lists each step of the process.

Removes multiple directories with similar names using wildcards and lists each step of the process.

Ignores errors due to non-empty directories when attempting to remove the LINUX directory.

PreviousrmNextcp

Last updated 11 months ago

Was this helpful?

rmdir mydir1 mydir2 mydir3 .....
rmdir LINUX INFO DETAIL
rmdir -p mydir1/mydir2/mydir3/...../mydirN
rmdir -p LINUX/mydir1/mydir2/mydir3
rmdir -p -v Example/Test
rmdir -v dir1 dir2 dir3
rmdir -v LINUX INFO DETAIL
rmdir -v LINUX*
rmdir -v Example/Test Example
rmdir -v Example*
rmdir --ignore-fail-on-non-empty LINUX