1.命令功能
rm :删除目录或文件
2.命令格式
rm [选项] 目录或文件
3.命令参数
-i :进行交互式删除
-r :递归删除,删除目录
-f :强制删除
-v :显示详细信息
4.命令实例
例子1:交互式删除
[root@bogon ~]# rm -ir abc
rm: remove directory `abc‘? yes
[root@bogon ~]# ls
anaconda-ks.cfg Desktop file1 file2 gg install.log install.log.syslog
例子2:删除目录,递归删除
[root@bogon ~]# mkdir -pv aa/bb/cc/dd
mkdir: created directory `aa‘
mkdir: created directory `aa/bb‘
mkdir: created directory `aa/bb/cc‘
mkdir: created directory `aa/bb/cc/dd‘
[root@bogon ~]# rm -r aa
rm: descend into directory `aa‘? yes
rm: descend into directory `aa/bb‘? yes
rm: remove directory `aa/bb/cc‘? yes
rm: remove directory `aa/bb‘? yes
rm: remove directory `aa‘? yes
例子3:强制删除
[root@bogon ~]# mkdir -pv aa/bb/cc/dd
mkdir: created directory `aa‘
mkdir: created directory `aa/bb‘
mkdir: created directory `aa/bb/cc‘
mkdir: created directory `aa/bb/cc/dd‘
[root@bogon ~]# rm -rf aa
[root@bogon ~]# ls
anaconda-ks.cfg Desktop file1 file2 gg install.log install.log.syslog
本文出自 “冷血杀手” 博客,请务必保留此出处http://deathkiller.blog.51cto.com/9130248/1592327
原文地址:http://deathkiller.blog.51cto.com/9130248/1592327