rm命令主要用于文件或者文件夹的删除
参数:
-f, --force:忽略提示
-i:删除时,要求确认
-r, -R, --recursive:递归删除 SourceByrd's Weblog-https://note.t4x.org/rebuilding/rm-command-description/
其他参数:SourceByrd's Weblog-https://note.t4x.org/rebuilding/rm-command-description/
--interactive[=WHEN]
note:prompt according to WHEN: never, once (-I), or always (-i). Without WHEN, prompt alwaysSourceByrd's Weblog-https://note.t4x.org/rebuilding/rm-command-description/--one-file-system
note:when removing a hierarchy recursively, skip any directory that is on a file system different from that of the corresponding command line argumentSourceByrd's Weblog-https://note.t4x.org/rebuilding/rm-command-description/--no-preserve-root
note:do not treat ‘/’ speciallySourceByrd's Weblog-https://note.t4x.org/rebuilding/rm-command-description/--preserve-root
note:do not remove ‘/’ (default) SourceByrd's Weblog-https://note.t4x.org/rebuilding/rm-command-description/
案例:
0 1 2 3 4 5 6 7 |
[root@localhost ~]# mkdir /tmp/abc/bcd/cd/d -p [root@localhost abc]# rm 2 rm: remove regular empty file `2'? n [root@localhost abc]# rm -i 2 #要求确认 rm: remove regular empty file `2'? n [root@localhost abc]# rm -f 2 #直接删除 [root@localhost ~]# cd /tmp/abc [root@localhost abc]# rm -rf bcd #删除目录以及目录文件 |