In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 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 Linux basic command rmdir", interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Let Xiaobian take you to learn "the usage of Linux basic command rmdir"!
rmdir
Delete an empty directory, you can also delete the parent directory through, but make sure there is nothing else in the parent directory.
This command applies to Red Hat, RHEL, Ubuntu, CentOS, SUSE, openSUSE, Fedora.
1. Grammar
rmdir [options] dir
2. Option list
option
description
--version
Display command version information
--help
Show Help Documentation
--ignore-fail-on-non-empty
Ignore error messages caused by non-empty directories
-p | --parent
Delete directories, and parent directories routed
-v | --verbose
show details
3. Examples
1) Simply delete a directory
[root@localhost weijie]# ls -l test //View directory details
Total consumption 4
drwxr-xr-x 2 root root 4096 Sep 10 21:21 test
[root@localhost weijie]# rmdir testt/test/ //delete a subdirectory from the directory
[root@localhost weijie]# ls -l test //View directory information
Total consumption 0
2) Use the-p option to delete the child directory and the parent directory through which it passes. The parent directory has only one current child directory.
[root@localhost weijie]#mkdir test02/test //create directory test in test02
You have new mail in /var/spool/mail/root
[root@localhost weijie]# ls test02/ //Check if it was created successfully
test
[root@localhost weijie]# rmdir -p test02/test/ //Delete the directory test using the-p option, which will cause test02 to be deleted together
[root@localhost weijie]# ls //Check the current directory, test02 is no longer there
1.c link link1 link2 my.iso test testt wj234.q1C wjtpflR
3) Use the-p option to delete subdirectories and parent directories that pass through, where there are other contents
[root@localhost weijie]# ls testt/ //View directory contents
1.c test
[root@localhost weijie]# rmdir -p testt/test/ //delete with-p option
rmdir: Failed to delete directory "testt": directory is not empty//Error deleting parent directory testt because there are other contents in this directory
[root@localhost weijie]# ls testt/ //View, subdirectory deleted
1.c
4) Change owner and group simultaneously
[root@localhost weijie]# ls -l 1.c //The current group is weijie
-rwxr--r-- 1 rootweijie 0 Sep 7 09:11 1.c
[root@localhost weijie]# chown 500:500 1.c //Change both group and owner to 500, pay attention to syntax, there is a colon in the middle
[root@localhost weijie]# ls -l 1.c
-rwxr--r-- 1 david david 0 September 7 09:11 1.c
Made a Linux learning platform, currently out of a prototype, you can refer to the use
Link: https://pan.baidu.com/s/1GOLVU2CbpBNGtunztVpaCQ Password:n7bk
At this point, I believe that everyone has a deeper understanding of the "Linux basic command rmdir usage", may wish to actually operate it! Here is the website, more related content can enter the relevant channels for inquiry, pay attention to 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.
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.