(1) rm是常用的命令,该命令的功能为删除一个目录中的一个或多个文件或目录,它也可以将某个目录及其下的所有文件及子目录均删除。对于链接文件,只是删除了链接,原有文件均保持不变。

      (2)rm很危险,一定要小心使用:比如在/(根目录)下执行rm * -rf,那么系统就会被删除。

    

  (3)NAME

       rm - remove files or directories

   (4)SYNOPSIS

       rm [OPTION]... FILE...

   (5)OPTIONS

       Remove (unlink) the FILE(s).

     -f, --force    删除文件时,直接删除,不给出提示。

     -i, --interactive 进行交互式删除,就是删除前给出提示。

     -r, -R, --recursive   指示rm将参数中列出的全部目录和子目录均递归地删除。

     -v, --verbose    详细显示进行的步骤

   [root@linux-node1 test]# rm mv3       默认会提示,是否删除

   rm: remove regular empty file `mv3'? 

   

   [root@linux-node1 test]# rm -f mv3    加-f不提示直接删除

   

   [root@linux-node1 test]# rm -i rm.txt      加-i参数:默认会提示,是否删除

    rm: remove regular file `rm.txt'? 

   

   

   [root@linux-node1 tmp]# rm -r test   递归删除所有文件

   rm: descend into directory `test'? y

   rm: remove directory `test/mv-dir2'? y

   rm: descend into directory `test/mv-dir'? y

   rm: remove regular file `test/mv-dir/mv2'? y

   rm: remove regular empty file `test/mv-dir/mv1'? y

   rm: remove directory `test/mv-dir'? y


   [root@linux-node1 tmp]# rm -R test   递归删除所有文件

   rm: descend into directory `test'? y

   rm: remove regular file `test/rm.txt'? y

   rm: remove directory `test/mv-dir1'? y

   rm: remove directory `test'? n

   [root@linux-node1 tmp]# 


   [root@linux-node1 tmp]# rm -rf test2   不提示直接删除