"Linux learning is not difficult" file/directory management (7): rmdir command deletes empty directories

7.7 "Linux learning is not difficult" file/directory management (7): rmdir command deletes empty directories

Empty directories can be removed in Linux systems using the rmdir command.

Command syntax:

rmdir [options] [directory]

The meaning of each option in the command is shown in the table.

Options

Meaning of options

-p

Recursively delete a directory. When a subdirectory is deleted and its parent directory is empty, it is also deleted.

      Example: delete the empty directory newdir1.

[root@rhel ~]# rmdir newdir1

Example: Delete the two empty directories /root/newdir2 and /root/newdir2/newdir3 at the same time.

[root@rhel ~]# rmdir -p /root/newdir2/newdir3


This article is excerpted from " Learning Linux is not difficult"Teaching material, this is a most practical Linux introductory teaching material with equal emphasis on theory and practice. To read the entire book, please visit Linux Operators ( www.linuxywz.com) website .

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324894916&siteId=291194637