[root@smart linux]# rm -r a rm: remove regular file `a'? y [root@smart linux]# rm -r g rm: descend into directory `g'? y rm: remove directory `g/abcde'? y rm: remove directory `g'? y [root@smart linux]# rm -R e rm: descend into directory `e'? y rm: remove regular file `e/b.c'? y rm: remove directory `e'? y [root@smart linux]# ls A a.txt B b.c~ c f kl.txt rm.txt s.txt abcde b b.c b.txt d h k.txt ss test [root@smart linux]#
[root@smart linux]# rm -i a.t rm: cannot remove `a.t': No such file or directory [root@smart linux]# rm a.t rm: cannot remove `a.t': No such file or directory [root@smart linux]#
4)-v
-v表示:执行后显示正在进行的动作,同其他命令。
1 2 3 4 5 6 7 8 9
[root@smart linux]# rm -v a.txt b.txt rm: cannot remove `a.txt': No such file or directory rm: cannot remove `b.txt': No such file or directory [root@smart linux]# rm -v k.txt rm: remove regular file `k.txt'? y removed `k.txt' [root@smart linux]# rm -fv s.txt removed `s.txt' [root@smart linux]#
[root@smart linux]# rm --preserve-root / rm: cannot remove `/': Is a directory [root@smart linux]# rm --preserve-root / b rm: cannot remove `/': Is a directory rm: remove regular file `b'? y [root@smart linux]# ls A abcde B b.c b.c~ c d f h kl.txt rm.txt ss test [root@smart linux]# ls / bin cgroup etc lib media mnt opt root selinux sys usr boot dev home lost+found misc net proc sbin srv tmp var