@rm删除文件及文件夹

删除文件及文件夹

  • -f : 免交互删除

    [root@string ~]# touch {1..9}txt
    [root@string ~]# ls
    1txt   2txt  4txt  6txt  8txt  abc      one         test
    1.txt  3txt  5txt  7txt  9txt  bash.sh  proxy.conf  系统优化.md
    [root@string ~]# rm -f 1txt 
    [root@string ~]# ls
    1.txt  3txt  5txt  7txt  9txt  bash.sh  proxy.conf  系统优化.md
    2txt   4txt  6txt  8txt  abc   one      test
    
  • -i : 增加一个删除前的提示

    [root@string ~]# rm -i proxy.conf 
    rm: remove regular file ‘proxy.conf’? 
    
  • -r : 递归删除

    # 可以多级目录删除
    [root@string ~]# rm -r abc/
    rm: descend into directory ‘abc/’? y
    rm: descend into directory ‘abc/bcd’? y
    rm: descend into directory ‘abc/bcd/cde’? y
    rm: remove directory ‘abc/bcd/cde/def’? y
    rm: remove directory ‘abc/bcd/cde’? y
    rm: remove directory ‘abc/bcd’? y
    rm: remove directory ‘abc/’? y
    
  • 删库跑路

    # rm -rf /
    
    彻底删除根目录,不提示,系统文件损坏,系统瘫痪
    
    
posted @ 2021-03-12 23:08  ଲ一笑奈&何  阅读(14)  评论(0编辑  收藏  举报