Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use the rmdir command of linux to delete an empty directory

2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

Today, the editor shares with you how to use linux's rmdir command to delete empty directories. I believe many people don't know much about it. In order to make you understand better, I summarized the following contents and looked down together. I'm sure you'll get something.

The function of the rmdir command is to delete the empty directory, the full name in English is "remove directory".

Note: the rmdir command can only delete empty directories. When you want to delete a non-empty directory, use the rm command with the "- R" option.

The "- p" parameter of the rmdir command can recursively delete a specified multi-level directory, but requires that each directory must also be empty.

Syntax format: rmdir [parameters] [directory name]

Common parameters:

Reference example

Delete an empty directory:

[root@linuxcool ~] # rmdir dir

Recursively delete the specified directory tree:

[root@linuxcool] # rmdir-p dir/dir_1/dir_2

Displays the detailed execution process of the instruction:

[root@linuxcool] # rmdir-v dir

Rmdir: deleting directory 'dir' [root@linuxcool ~] # rmdir-p-v dir/dir_1/dir_2

Rmdir: deleting directory 'dir/dir_1/dir_2

Rmdir: deleting directory 'dir/dir_1'

Rmdir: deleting directory 'dir_2'

Displays the version information of the command:

[root@linuxcool] # rmdir-- versionrmdir (GNU coreutils) 8.30Copyright (C) 2018 Free Software Foundation, Inc. License GPLv3+:GNU General Public license version 3 or later https://gnu.org/licenses/gpl.html. This software is free: you are free to modify and redistribute it. There is no other guarantee within the scope of the law. On how to use linux's rmdir command to delete the empty directory is shared here, I hope that the above content can have a certain reference value, you can learn to apply. If you like this article, you might as well share it for more people to see.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report