rm(1) 맨 페이지 - 윈디하나의 솔라나라

개요

섹션
맨페이지이름
검색(S)

rm

Name
     rm, rmdir - remove directory entries

Synopsis
     /usr/bin/rm [-f] [-i] file...


     /usr/bin/rm -rR [-f] [-i] dirname... [file]...


     /usr/xpg4/bin/rm [-fiRr] file...


     /usr/bin/rmdir [-ps] dirname...

Description
  /usr/bin/rm /usr/xpg4/bin/rm
     The rm utility removes the directory entry specified by each
     file  argument.  If  a  file has no write permission and the
     standard input is a terminal, the full  set  of  permissions
     (in  octal)  for the file are printed followed by a question
     mark. This is a prompt for confirmation. If  the  answer  is
     affirmative,   the  file  is  deleted,  otherwise  the  file
     remains.


     If file is a symbolic link, the link  is  removed,  but  the
     file  or  directory to which it refers is not deleted. Users
     do not need write permission to remove a symbolic link, pro-
     vided they have write permissions in the directory.


     If multiple files are specified and removal of a file  fails
     for  any  reason, rm writes a diagnostic message to standard
     error, do nothing more to the current file, and go on to any
     remaining files.


     If the  standard  input  is  not  a  terminal,  the  utility
     operates as if the -f option is in effect.

  /usr/bin/rmdir
     The rmdir utility removes the directory entry  specified  by
     each  dirname  operand,  which must refer to an empty direc-
     tory.


     Directories are processed  in  the  order  specified.  If  a
     directory and a subdirectory of that directory are specified
     in a single invocation of rmdir, the  subdirectory  must  be
     specified  before  the  parent  directory so that the parent
     directory is empty when rmdir tries to remove it.

Options
     The following options  are  supported  for  /usr/bin/rm  and
     /usr/xpg4/bin/rm:

     -r
           Recursively removes directories and subdirectories  in
           the  argument  list. The directory is emptied of files
           and removed. The user is normally prompted for removal
           of  any write-protected files which the directory con-
           tains. The write-protected files are  removed  without
           prompting,  however,  if  the -f option is used, or if
           the standard input is not a terminal and the -i option
           is not used.

           Symbolic links that are encountered with  this  option
           is not traversed.

           If the removal of a non-empty, write-protected  direc-
           tory  is  attempted, the utility always fails (even if
           the -f option is used), resulting in an error message.


     -R
           Same as -r option.


  /usr/bin/rm
     The following options are supported for /usr/bin/rm only:

     -f
           Removes files (even if write-protected) in a directory
           without  prompting  the  user.  In  a  write-protected
           directory, however, files are never removed  (whatever
           their permissions are) and no messages are displayed.


     -i
           Interactive. With this option, rm prompts for  confir-
           mation  before removing any files. It overrides the -f
           option and remains in  effect  even  if  the  standard
           input is not a terminal.


  /usr/xpg4/bin/rm
     The following options  are  supported  for  /usr/xpg4/bin/rm
     only:

     -f
           Does not prompt for confirmation. Does not write diag-
           nostic  messages or modify the exit status in the case
           of non-existent operands. Any previous occurrences  of
           the -i option is ignored.

     -i
           Prompts for confirmation. Any occurrences  of  the  -f
           option is ignored.


  /usr/bin/rmdir
     The following options are supported for /usr/bin/rmdir only:

     -p
           Allows users to remove the directory dirname  and  its
           parent  directories  which  become empty. A message is
           printed to standard error if all or part of  the  path
           could not be removed.


     -s
           Suppresses the message printed on the  standard  error
           when -p is in effect.

Operands
     The following operands are supported:

     file
                Specifies the pathname of a directory entry to be
                removed.


     dirname
                Specifies the pathname of an empty  directory  to
                be removed.

Usage
     See largefile(5) for the description of the behavior  of  rm
     and rmdir when encountering files greater than or equal to 2
     Gbyte (2^31 bytes).

Examples
     The following examples are valid for the commands shown.

  /usr/bin/rm, /usr/xpg4/bin/rm
     Example 1 Removing Directories


     The following command removes the  directory  entries  a.out
     and core:


       example% rm a.out core



     Example 2 Removing a Directory without Prompting

     The following command removes the directory junk and all its
     contents, without prompting:


       example% rm -rf junk



  /usr/bin/rmdir
     Example 3 Removing Empty Directories


     If a directory a in the current directory is  empty,  except
     that it contains a directory b, and a/b is empty except that
     it contains a directory c, the following command removes all
     three directories:


       example% rmdir -p a/b/c

Environment Variables
     See environ(5) for descriptions of the following environment
     variables  that  affect the execution of rm and rmdir: LANG,
     LC_ALL, LC_COLLATE, LC_CTYPE, LC_MESSAGES, and NLSPATH.


     Affirmative responses are processed using the extended regu-
     lar  expression  defined  for  the  yesexpr  keyword  in the
     LC_MESSAGES category of the user's locale. The locale speci-
     fied  in  the  LC_COLLATE  category  defines the behavior of
     ranges, equivalence classes, and  multi-character  collating
     elements  used  in  the  expression defined for yesexpr. The
     locale specified  in  LC_CTYPE  determines  the  locale  for
     interpretation  of sequences of bytes of text data a charac-
     ters, the behavior of character classes used in the  expres-
     sion defined for the yesexpr. See locale(5).

Exit Status
     The following exit values are returned:

     0
           If the -f option was  not  specified,  all  the  named
           directory  entries  were  removed;  otherwise, all the
           existing named directory entries were removed.


     >0
           An error occurred.

Attributes

     See attributes(5) for descriptions of the  following  attri-
     butes:

  /usr/bin/rm, /usr/bin/rmdir
     tab() box; cw(2.75i) |cw(2.75i) lw(2.75i) |lw(2.75i)  ATTRI-
     BUTE  TYPEATTRIBUTE  VALUE  _  Availabilitysystem/core-os  _
     CSIEnabled


  /usr/xpg4/bin/rm
     tab() box; cw(2.75i) |cw(2.75i) lw(2.75i) |lw(2.75i)  ATTRI-
     BUTE  TYPEATTRIBUTE  VALUE _ Availabilitysystem/xopen/xcu4 _
     CSIEnabled  _  Interface  StabilityCommitted  _  StandardSee
     standards(5).

See Also
     rmdir(2),  unlink(2),  attributes(5),   environ(5),   largefile(5),
     standards(5)

Diagnostics
     It is forbidden to remove the files "." and ".." in order to
     avoid the consequences of inadvertently doing something like
     the following:

       example% rm -r .*




     It is forbidden to remove the file "/" in order to avoid the
     consequences of inadvertently doing something like:

       example% rm -rf $x/$y




     or

       example% rm -rf /$y




     when $x and $y expand to empty strings.

Notes
     A - permits the user to mark explicitly the end of any  com-
     mand  line  options, allowing rm to recognize file arguments
     that begin with a -. As an aid to BSD migration, rm  accepts
     -- as a synonym for -. This migration aid may disappear in a
     future release. If a -- and a - both appear on the same com-
     mand line, the second is interpreted as a file.
맨 페이지 내용의 저작권은 맨 페이지 작성자에게 있습니다.
RSS ATOM XHTML 1.0 CSS3