learn about Linux commands today: RmDir Command . rmdir is a commonly used command, the function of which is to delete an empty directory before a directory is deleted must be empty. (Note that the Rm-r dir command can be used instead of rmdir, but there is a lot of danger.) You must also have write access to the parent directory when you delete a directory.
1. command format:
rmdir [Options] ... Directory...
2. Command function:
This command removes one or more subdirectory entries from a directory , When you delete a directory, you must also have the parent directory the Write permission.
3. Command parameters:
- p recursively deletes the directory dirname, which is also deleted when its parent directory is empty after the subdirectory is deleted. If the entire path is deleted or a portion of the path is retained for some reason, the system displays the corresponding message on the standard output .
-V,--verbose Show instruction execution Process
4. Command instance:
Example one:rmdir cannot delete a non-empty directory
Command:
Rmdi R Doc
Output:
[email protected] scf]# tree.|--bin|--Doc| |--Info| `--Product|--Lib|--logs| |--Info| `--Product '--Service '--Deploy|--Info `--Product ADirectories,0Files[[email protected] scf]#rmdirDocrmdir: Doc: Directory not empty [[email protected] scf]#rmdirdoc/Info[email protected] scf]#rmdirdoc/product[[email protected] scf]# tree.|--bin|--Doc|--Lib|--logs| |--Info| `--Product '--Service '--Deploy|--Info `--ProductTenDirectories,0Files
Description
rmdir Directory name command cannot delete a non-empty directory directly
Example 2:rmdir-p When a subdirectory is deleted and makes it an empty directory, delete it by the way
Command:
Rmdir-p logs
Output:
[email protected] scf]# tree.|--bin|--Doc|--Lib|--logs| `--Product '--Service '--Deploy|--Info `--ProductTenDirectories,0Files[[email protected] scf]#rmdir-p Logsrmdir: Logs: Directory not empty [[email protected] scf]# tree.|--bin|--Doc|--Lib|--logs| `--Product '--Service '--Deploy|--Info `--Product9Directories,0Files[[email protected] scf]#rmdir-P logs/product[[email protected] scf]# tree.|--bin|--Doc|--Lib '--Service '--Deploy|--Info `--Product7Directories,0Files
Linux Common commands: rmdir command