命令簡介:
rmdir命令用用來刪除空目錄,如果目錄非空,則會出現錯誤。可以使用rm刪除目錄中的文件后,使用rmdir刪除目錄。也可以使用rm -rf替代rmdir命令。這是一個非常簡單的命令。
命令語法:
rmdir [OPTION]... DIRECTORY...
命令參數:
參數
長參數
描敘
--ignore-fail-on-non-empty
忽略任何應目錄里面有數據文件而造成的錯誤
-p
--parents
遞歸刪除目錄
-v
--verbose
顯示命令執行的詳細信息
--help
顯示命令在線幫助
--version
顯示命令版本信息
使用示例:
1: 查看rmdir命令的幫助信息
[root@DB-Server ~]# rmdir --helpUsage: rmdir [OPTION]... DIRECTORY...Remove the DIRECTORY(ies), if they are empty. --ignore-fail-on-non-empty ignore each failure that is solely because a directory is non-empty -p, --parents Remove DIRECTORY and its ancestors. E.g., `rmdir -p a/b/c' is similar to `rmdir a/b/c a/b a'. -v, --verbose output a diagnostic for every directory processed --help display this help and exit --version output version information and exit Report bugs to <bug-coreutils@gnu.org>.
也可以使用下面命令查看rmdir文檔信息
[root@DB-Server ~]# man rmdir
2: 使用rmdir刪除空目錄
如果目錄非空,則會出現錯誤信息。
[root@DB-Server ~]# ls /root/kerry/file1[root@DB-Server ~]# rmdir kerryrmdir: kerry: Directory not empty[root@DB-Server ~]# rm -f /root/kerry/*[root@DB-Server ~]# rmdir kerry
3:顯示命令執行時的詳細信息
[root@DB-Server ~]# mkdir test1 test2 test3[root@DB-Server ~]# lsanaconda-ks.cfg Desktop install.log install.log.syslog test1 test2 test3[root@DB-Server ~]# rmdir -v test1 test2 test3rmdir: removing directory, test1rmdir: removing directory, test2rmdir: removing directory, test3
新聞熱點
疑難解答