Chapter 2. Linux Key Commands

Rmdir (Remove Directory)

Rmdir (Remove Directory)
Tag:

When a directory is empty

You can delete an empty directory using the rmdir (ReMove DIRectory) command.

For example, to delete an empty directory named dir_a under your working directory, run the command below.

Command Line - INPUT
rmdir dir_a

When a directory is not empty

The rmdir command won't work for a non-empty directory. You need to use the rm command with the -r option like in the command below.

Command Line - INPUT
rm -r dir_a

The rm command will be explained later.

When a directory is empty

You can delete an empty directory using the rmdir (ReMove DIRectory) command.

For example, to delete an empty directory named dir_a under your working directory, run the command below.

Command Line - INPUT
rmdir dir_a

When a directory is not empty

The rmdir command won't work for a non-empty directory. You need to use the rm command with the -r option like in the command below.

Command Line - INPUT
rm -r dir_a

The rm command will be explained later.

Tag: