本文主要是介绍Linux 常用命令3-- 目录操作rmdir 和 rm,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
rmdir 删除文件或目录 全称: Remove Directory
使用方式 : rmdir [-p] 目录名称
参数:
-p:递归的删除目录(目录必须为空)
[root@localhost mail]# rmdir --help
Usage: rmdir [OPTION]... DIRECTORY...
Remove the DIRECTORY(ies), if they are empty.--ignore-fail-on-non-emptyignore each failure that is solely because a directoryis non-empty-p, --parents remove DIRECTORY and its ancestors; e.g., `rmdir -p a/b/c' issimilar 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
rm 删除文件或目录 全称: Remove
使用方式 : rm [-pr] 目录名称
参数:
-f:忽略不存在的文件,不出先警告信息
-i:互动模式,在删除前询问是否操作
-r:递归删除,常用在目录删除,相当危险
[root@localhost mail]# rm --help
Usage: rm [OPTION]... FILE...
Remove (unlink) the FILE(s).-f, --force ignore nonexistent files, never prompt-i prompt before every removal-I prompt once before removing more than three files, orwhen removing recursively. Less intrusive than -i,while still giving protection against most mistakes--interactive[=WHEN] prompt according to WHEN: never, once (-I), oralways (-i). Without WHEN, prompt always--one-file-system when removing a hierarchy recursively, skip anydirectory that is on a file system different fromthat of the corresponding command line argument--no-preserve-root do not treat `/' specially--preserve-root do not remove `/' (default)-r, -R, --recursive remove directories and their contents recursively-v, --verbose explain what is being done--help display this help and exit--version output version information and exitBy default, rm does not remove directories. Use the --recursive (-r or -R)
option to remove each listed directory, too, along with all of its contents.To remove a file whose name starts with a `-', for example `-foo',
use one of these commands:rm -- -foorm ./-fooNote that if you use rm to remove a file, it is usually possible to recover
the contents of that file. If you want more assurance that the contents are
truly unrecoverable, consider using shred.
这篇关于Linux 常用命令3-- 目录操作rmdir 和 rm的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!