Contained WithinFind More DocumentationFeatured Support Resources | Descargar este libro en PDF (7229 KB)
rm(1)Name | Synopsis | Description | Options | Operands | Usage | Examples | Environment Variables | Exit Status | Attributes | See Also | Diagnostics | Notes Name
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... ksh93/usr/bin/rmdir [-eps] dirname... Description/usr/bin/rm /usr/xpg4/bin/rmThe 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, 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/rmdirThe 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. ksh93The rmdir built-in in ksh93 is associated with the /bin and /usr/bin paths. It is invoked when rmdir is executed without a pathname prefix and the pathname search finds a /bin/rmdir or /usr/bin/rmdir executable. rmdir deletes each given directory. The directory must be empty and contain no entries other than . or ... If a directory and a subdirectory of that directory are specified as operands, the subdirectory must be specified before the parent, so that the parent directory is empty when rmdir attempts to remove it. Options
The following options are supported for /usr/bin/rm and /usr/xpg4/bin/rm: /usr/bin/rmThe following options are supported for /usr/bin/rm only: /usr/xpg4/bin/rmThe following options are supported for /usr/xpg4/bin/rm only: /usr/bin/rmdirThe following options are supported for /usr/bin/rmdir only: ksh93The following options are supported for the rmdir built-in for ksh93: Operands
The following operands are supported: UsageSee largefile(5) for the description of the behavior of rm and rmdir when encountering files greater than or equal to 2 Gbyte ( 231 bytes). ExamplesThe following examples are valid for the commands shown. /usr/bin/rm, /usr/xpg4/bin/rmExample 1 Removing DirectoriesThe following command removes the directory entries a.out and core:
Example 2 Removing a Directory without PromptingThe following command removes the directory junk and all its contents, without prompting:
/usr/bin/rmdirEnvironment VariablesSee 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 regular expression 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 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 characters, the behavior of character classes used in the expression defined for the yesexpr. See locale(5). Exit Status
The following exit values are returned: ksh93AttributesSee attributes(5) for descriptions of the following attributes: /usr/bin/rm, /usr/bin/rmdir/usr/xpg4/bin/rm
ksh93See AlsoDiagnosticsAll messages are generally self-explanatory. It is forbidden to remove the files “.” and “..” in order to avoid the consequences of inadvertently doing something like the following:
It is forbidden to remove the file “/” in order to avoid the consequences of inadvertently doing something like:
or
when $x and $y expand to empty strings. NotesA - permits the user to mark explicitly the end of any command 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 command line, the second is interpreted as a file. Name | Synopsis | Description | Options | Operands | Usage | Examples | Environment Variables | Exit Status | Attributes | See Also | Diagnostics | Notes |
|||||||||||||||