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

The usage of rmdir command in linux

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

Share

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

This article mainly explains "the usage of rmdir command in linux". Interested friends may wish to have a look at it. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn the usage of the rmdir command in linux.

1. Command format:

Rmdir [options]... Catalogue.

2. Command function:

This command deletes one or more subdirectory entries from a directory and must have write access to the parent directory when deleting a directory.

3. Command parameters:

-p the directory dirname is deleted recursively, and is also deleted when the parent directory is empty after the subdirectory is deleted. If the entire path is deleted or part of the path is retained for some reason, the system displays the corresponding information on the standard output.

-v,-- verbose shows the instruction execution process

4. Command example:

Example 1: rmdir cannot delete non-empty directories

Command:

Rmdir doc

Output:

[root@localhost scf] # tree

.

|-- bin

|-- doc

| |-- info |

| | `--product |

|-- lib

|-- logs

| |-- info |

| | `--product |

`--service

`--deploy

|-- info

`--product

12 directories, 0 files

[root@localhost scf] # rmdir doc

Rmdir: doc: directory is not empty

[root@localhost scf] # rmdir doc/info

[root@localhost scf] # rmdir doc/product

[root@localhost scf] # tree

.

|-- bin

|-- doc

|-- lib

|-- logs

| |-- info |

| | `--product |

`--service

`--deploy

|-- info

`--product

10 directories, 0 files

Description:

The rmdir directory name command cannot delete a non-empty directory directly

Instance 2:rmdir-p if the subdirectory is deleted so that it is also empty, it will be deleted by the way

Command:

Rmdir-p logs

Output:

[root@localhost scf] # tree

.

|-- bin

|-- doc

|-- lib

|-- logs

| | `--product |

`--service

`--deploy

|-- info

`--product

10 directories, 0 files

[root@localhost scf] # rmdir-p logs

Rmdir: logs: directory is not empty

[root@localhost scf] # tree

.

|-- bin

|-- doc

|-- lib

|-- logs

| | `--product |

`--service

`--deploy

|-- info

`--product

9 directories, 0 files

[root@localhost scf] # rmdir-p logs/product

[root@localhost scf] # tree

.

|-- bin

|-- doc

|-- lib

`--service

`--deploy

|-- info

`--product

7 directories, 0 files

At this point, I believe you have a deeper understanding of "the use of the rmdir command in linux". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

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