In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-03 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article introduces the relevant knowledge of "case analysis of the use of rmdir commands in linux". Many people will encounter such a dilemma in the operation of actual cases, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
Rmdir is a commonly used command, the function of this command is to delete an empty directory, a directory must be empty before it is deleted. (note that the rm-r dir command can replace rmdir, but it is very dangerous. You must also have write access to the parent directory when you delete a directory
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:
The copy code is as follows:
[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:
The copy code is as follows:
[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
Summary:
This command is used to delete an empty directory, and if the directory is not empty, an error occurs. You can use rm to delete files in a directory and rmdir to delete a directory. You can also use rm-rf instead of the rmdir command. This is a very simple command.
This is the end of the content of "case Analysis of the use of rmdir commands in linux". Thank you for your reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.