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

What is the use of the rmdir command in Linux

2025-03-13 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

This article mainly introduces the use of the rmdir command in Linux. It is very detailed and has a certain reference value. Friends who are interested must finish reading it!

The Linux common command rmdir command is used to delete empty directories. When the directory is no longer in use, or the disk space has reached the usage limit, you need to delete the directory that has lost its use value.

Rmdir is used to delete empty directories

Add that you can delete one or more empty subdirectories from a directory with the rmdir command. This command removes one or more subdirectories from a directory, where dirname represents the directory name. If no path is specified in dirname, delete the directory specified by dirname under the current directory; if the path is included in dirname, delete the directory at the specified location. When you delete a directory, you must have write access to its parent directory.

Note: the subdirectory should be empty before it is deleted. That is, all files in this directory must be rm, and the current working directory must be above the deleted directory, not the deleted directory itself, nor a subdirectory of the deleted directory.

Although you can also recursively delete all files in a directory and the directory itself with the rm command with the-r option, it is dangerous to do so.

Syntax rmdir (option) (parameter) option-p or-- parents: delete the specified directory if the upper directory of the directory has become empty;-- ignore-fail-on-non-empty: this option causes the rmdir command to ignore the error message caused by deleting a non-empty directory;-v or-verboes: displays the detailed execution of the command;-- help: displays the help information of the command -- version: displays the version information of the command. Parameter directory list: an empty directory list to delete. When multiple empty directories are deleted, directory names are separated by spaces.

For example, delete the subdirectory named www under the working directory:

Rmdir www delete the subdirectory named Test in the www directory under the working directory. If the www directory becomes empty after the Test is deleted, the www will also be deleted.

The following command of rmdir-p www/Test is equivalent to rmdir a/b/c, rmdir a www/Test b, rmdir a

Rmdir-p a/b/c above is all the content of this article "what is the use of rmdir commands in Linux?" Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!

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

Development

Wechat

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

12
Report