rm - remove files or directories

来源:互联网 发布:阿里智能 应用层数据 编辑:程序博客网 时间:2024/06/05 11:56
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
        设置提示次数
       --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)

       -r, -R, --recursive
              remove directories and their contents recursively
        指示rm将参数中列出的全部目录和子目录均递归地删除
       -d, --dir
              remove empty directories
        删除空目录
       -v, --verbose
              explain what is being done
        显示
       --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

          删除空格的文件用“”,删除 “-”开头文件使用 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.

        rm删除文件理论上可以恢复,sherd无法恢复

        rm非常危险,因此可以使用alias将rm命令删除文件存放在某一位置,定期删除

0 0
原创粉丝点击