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

개요

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

rm(1)

rm(1)                            User Commands                           rm(1)

NAME
       rm, rmdir - remove directory entries

SYNOPSIS
       /usr/bin/rm [-f | --force] [-iI] [--interactive[=WHEN]]
            [-r | -R | --recursive] [--one-file-system]
            [--no-preserve-root] [--preserve-root] [--help]
            [-v | --verbose] file ...


       /usr/bin/rm -r | -R | --recursive [-f | --force] [--help] [-i]
            [--interactive[=WHEN]] [--one-file-system] [-I] [--preserve-root]
            [--no-preserve-root] [-v | --verbose] dirname... [file]...


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


       /usr/bin/rmdir [--ignore-fail-on-non-empty] [-p | --parents] [-s]
            [-v | --verbose] [--help] dirname ...

DESCRIPTION
   /usr/bin/rm, /usr/xpg4/bin/rm
       The rm utility removes the directory entry specified by each file argu‐
       ment.  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 direc‐
       tory to which it refers is not deleted. Users do not need write permis‐
       sion to remove a symbolic link, provided 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 directory.


       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:

       -r, -R, --recursive

           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 contains. The write-protected files are removed with‐
           out prompting, however, if the -f option is used, or if  the  stan‐
           dard input is not a terminal and the -i option is not used.

           Symbolic  links  that  are encountered with this option is not tra‐
           versed.

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


       --help

           Displays usage message and exits with return code 0.

       -f, --force

           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 confirmation before
           removing any files. It overrides the -f option and remains  in  ef‐
           fect even if the standard input is not a terminal.

       -I

           Prompts  for  confirmation if there more than three files; its less
           intrusive than -i option. It overrides the -f option and remains in
           effect even if the standard input is not a terminal

       --interactive[=WHEN]

           Prompts according to WHEN: never, once (-I), or always (-i).  With‐
           out WHEN, prompts always. It overrides the -f option and remains in
           effect even if the standard input is not terminal.

       --one-file-system

           When  removing recursively, skip directory from different file sys‐
           tem from that of the corresponding command line argument.

       --preserve-root

           Do not operate recursively on '/'. This is the default.

       --no-preserve-root

           Do not treat '/' specially.

       -v, --verbose

           Give a diagnostic for every file processed.


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

       -r, -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 contains. The write-protected files are removed with‐
           out  prompting,  however, if the -f option is used, or if the stan‐
           dard input is not a terminal and the -i option is not used.

           Symbolic links that are encountered with this option  is  not  tra‐
           versed.

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


       -f

           Does  not  prompt  for confirmation. Does not write diagnostic mes‐
           sages 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. If the options -i and -f are both speci‐
           fied, the last option takes the precedence.


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

       --help

           Displays usage message and exits with status 0.


       --ignore-fail-on-non-empty

           Ignores failure that is solely because a directory is non-empty.


       -p, --parents

           Allows users to remove the directory dirname and its parent  direc‐
           tories  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.


       -v, --verbose

           Outputs a diagnostic for the directory or directories processed.


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.


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 con‐
       tains a directory b, and a/b is empty except that it contains a  direc‐
       tory c, the following command removes all three directories:


         example% rmdir -p a/b/c


ENVIRONMENT VARIABLES
       See  environ(7) 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 regular expres‐
       sion defined for the yesexpr keyword in the LC_MESSAGES category of the
       user's locale. The locale specified in the LC_COLLATE category  defines
       the  behavior  of ranges, equivalence classes, and multi-character col‐
       lating elements used in the expression defined for yesexpr. The  locale
       specified  in  LC_CTYPE determines the locale for interpretation of se‐
       quences of bytes of text data a characters, the behavior  of  character
       classes used in the expression defined for the yesexpr. See locale(7).

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(7) for descriptions of the following attributes:

   /usr/bin/rm, /usr/bin/rmdir
       tab() box; cw(2.75i) |cw(2.75i) lw(2.75i) |lw(2.75i) ATTRIBUTE  TYPEAT‐
       TRIBUTE VALUE _ Availabilitysystem/core-os _ CSIEnabled


   /usr/xpg4/bin/rm
       tab()  box; cw(2.75i) |cw(2.75i) lw(2.75i) |lw(2.75i) ATTRIBUTE TYPEAT‐
       TRIBUTE VALUE _ Availabilitysystem/xopen/xcu4 _ CSIEnabled _  Interface
       StabilityCommitted _ StandardSee standards(7).


SEE ALSO
       rmdir(2), unlink(2), getopt_long(3C), mkdirp(3GEN), attributes(7), env‐
       iron(7), standards(7)

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  conse‐
       quences of inadvertently doing something like:

         example% rm -rf $x/$y



       or

         example% rm -rf /$y



       when $x and $y expand to empty strings.

NOTES
       Files  with names that start with the "−" character appear to rm as op‐
       tions rather than operands, complicating their removal. The special op‐
       tion "−−" (two hyphens) can be used to delimit the end of the  options.
       This  feature can be used with rm to remove files with names that start
       with a "−" character. See getopt(3C).


       For compatibility with older systems, rm accepts − as a synonym for −−.
       If a −− and a − both appear on the same command line, the second is in‐
       terpreted as a file argument.

HISTORY
       Support for the --force, --help, -I, --interactive, --no-preserve-root,
       --one-file-system, --preserve-root, --recursive, -v, and --verbose  op‐
       tions was added to /usr/bin/rm in Solaris 11.4.0.


       Support  for  the --ignore-fail-on-non-empty, --parents, -v, --verbose,
       and --help options was added to rmdir in Solaris 11.4.0.


       Support for operating recursively on the filesystem root  (/)  was  re‐
       moved from both rm commands in Solaris 10 3/05.


       Support for the -R option was added to both rm commands in Solaris 2.5.


       The /usr/xpg4/bin/rm command was added in Solaris 2.5.


       Support for the -p and -s options was added to rmdir in Solaris 2.0.


       The  rm  command, with support for the -f, -i, and -r options, has been
       present in all Sun and Oracle releases of Solaris.


       The rmdir command has been present in all Sun and  Oracle  releases  of
       Solaris.

Oracle Solaris 11.4               29 Nov 2022                            rm(1)
맨 페이지 내용의 저작권은 맨 페이지 작성자에게 있습니다.
RSS ATOM XHTML 5 CSS3