码迷,mamicode.com
首页 > 系统相关 > 详细

Linux -- rm, rmdir

时间:2014-08-30 22:53:10      阅读:311      评论:0      收藏:0      [点我收藏+]

标签:des   style   blog   http   color   os   io   strong   ar   

RM(1)                            User Commands                           RM(1)



NAME
       rm - remove files or directories

SYNOPSIS
       rm [OPTION]... FILE...

DESCRIPTION
       This  manual  page  documents  the  GNU version of rm.  rm removes each
       specified file.  By default, it does not remove directories.

       If the -I or --interactive=once option is given,  and  there  are  more
       than  three  files  or  the  -r,  -R, or --recursive are given, then rm
       prompts the user for whether to proceed with the entire operation.   If
       the response is not affirmative, the entire command is aborted.

       Otherwise,  if  a file is unwritable, standard input is a terminal, and
       the -f or --force  option  is  not  given,  or  the  -i  or  --interac‐
       tive=always  option is given, rm prompts the user for whether to remove
       the file.  If the response is not affirmative, the file is skipped.

OPTIONS
       Remove (unlink) the FILE(s).

 

**********************************************************************************************************

       -f, --force
              ignore nonexistent files and arguments, never prompt
      #不进行询问(默认),强制删除


       -i     prompt before every removal    

      #删除之前进行询问,每删一个文件询问一次

       -I     prompt once before removing  more  than  three  files,  or  when
              removing  recursively.  Less intrusive than -i, while still giv‐
              ing protection against most mistakes
       #当删除文件超过三个以上时进行询问


       --interactive[=WHEN]
              prompt according to WHEN: never,  once  (-I),  or  always  (-i).
              Without WHEN, prompt always

      #是否进行询问,一次或者每次

***********************************************************************************************************


       -r, -R, --recursive
              remove directories and their contents recursively

       -d, --dir
              remove empty directories

       -v, --verbose
              explain what is being done

 

*************************************************************************************************************

       --one-file-system
              when  removing  a hierarchy recursively, skip any directory that
              is on a file system different from  that  of  the  corresponding
              command line argument

      #跳过其他文件系统,对于多文件系统有重要的作用

       --no-preserve-root
              do not treat ‘/‘ specially

       --preserve-root
              do not remove ‘/‘ (default)


       --help display this help and exit

       --version
              output version information and exit

       By default, rm does not remove directories.  Use the --recursive (-r or
       -R) option to remove each listed directory, too, along with all of  its
       contents.


       To  remove a file whose name starts with a ‘-‘, for example ‘-foo‘, use
       one of these commands:

              rm -- -foo

              rm ./-foo            #删除开头为 “-” 文件 =_+

       Note that if you use rm to remove a  file,  it  might  be  possible  to
       recover  some  of its contents, given sufficient expertise and/or time.
       For greater assurance that the contents are truly  unrecoverable,  con‐
       sider using shred.

AUTHOR
       Written  by  Paul  Rubin, David MacKenzie, Richard M. Stallman, and Jim
       Meyering.

REPORTING BUGS
       Report rm bugs to bug-coreutils@gnu.org
       GNU coreutils home page: <http://www.gnu.org/software/coreutils/>
       General help using GNU software: <http://www.gnu.org/gethelp/>
       Report rm translation bugs to <http://translationproject.org/team/>

COPYRIGHT
       Copyright © 2013 Free Software Foundation, Inc.   License  GPLv3+:  GNU
       GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
       This  is  free  software:  you  are free to change and redistribute it.
       There is NO WARRANTY, to the extent permitted by law.

SEE ALSO
       unlink(1), unlink(2), chattr(1), shred(1)

       The full documentation for rm is maintained as a  Texinfo  manual.   If
       the  info and rm programs are properly installed at your site, the com‐
       mand

              info coreutils ‘rm invocation‘

       should give you access to the complete manual.



GNU coreutils 8.21                March 2014                             RM(1)

 

############################################################################################

############################################################################################

 

RMDIR(1)                         User Commands                        RMDIR(1)



NAME
       rmdir - remove empty directories      #单独拿出来删除一个空目录

SYNOPSIS
       rmdir [OPTION]... DIRECTORY...

DESCRIPTION
       Remove the DIRECTORY(ies), if they are empty.

       --ignore-fail-on-non-empty

              ignore each failure that is solely because a directory

              is non-empty

       -p, --parents
              remove  DIRECTORY  and  its ancestors; e.g., ‘rmdir -p a/b/c‘ is
              similar to ‘rmdir a/b/c a/b a‘

    #连带删除父目录

       -v, --verbose
              output a diagnostic for every directory processed

       --help display this help and exit

       --version
              output version information and exit

AUTHOR
       Written by David MacKenzie.

REPORTING BUGS
       Report rmdir bugs to bug-coreutils@gnu.org
       GNU coreutils home page: <http://www.gnu.org/software/coreutils/>
       General help using GNU software: <http://www.gnu.org/gethelp/>
       Report rmdir translation bugs to <http://translationproject.org/team/>

COPYRIGHT
       Copyright © 2013 Free Software Foundation, Inc.   License  GPLv3+:  GNU
       GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
       This  is  free  software:  you  are free to change and redistribute it.
       There is NO WARRANTY, to the extent permitted by law.

SEE ALSO
       rmdir(2)

       The full documentation for rmdir is maintained as a Texinfo manual.  If
       the  info  and  rmdir programs are properly installed at your site, the
       command

              info coreutils ‘rmdir invocation‘

       should give you access to the complete manual.



GNU coreutils 8.21                March 2014                          RMDIR(1)

 

 

!!!!!!!!!!!!!!!!!!!!!!!!

1 #rm -d target.d
2 #rmdir target.d 
3 
4 以上均只适用于来删除空目录

 

Linux -- rm, rmdir

标签:des   style   blog   http   color   os   io   strong   ar   

原文地址:http://www.cnblogs.com/IceSword-syy/p/3946919.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!