United States-English |
|
|
HP-UX Reference > Rrm(1)HP-UX 11i Version 3: February 2007 |
|
NAMErm — remove files or directories DESCRIPTIONThe rm command removes the entries for one or more files from a directory. If an entry was the last link to the file, the file is destroyed. Removal of a file requires write and search (execute) permission in its directory, but no permissions on the file itself. However, if the sticky bit is set on the directory containing the file, only the owner of the file, the owner of the directory, or a user having appropriate privileges can remove the file. If a user does not have write permission for a file to be removed and standard input is a terminal, a prompt containing the file name and its permissions is printed requesting that the removal of the file be confirmed (see Access Control Lists below). A line is then read from standard input. If that line begins with y the file is deleted; otherwise, the file remains. No questions are asked when the -f option is given or if standard input is not a terminal. If file is of type directory, and the -f option is not specified, and either the permissions of file do not permit writing and standard input is a terminal or the -i option is specified, rm writes a prompt to standard error and reads a line from standard input. If the response does not begin with y, it does nothing more with the current file and goes on to any remaining files. If file is a symbolic link, then only the symbolic link is removed. The file or directory pointed to by the symbolic link is not affected. If any of the intermediate path components of file happens to be a symbolic link, then rm follows the symbolic link and removes the file. Optionsrm recognizes the following options:
EXTERNAL INFLUENCESEnvironment VariablesLANG provides a default value for the internationalization variables that are unset or null. If LANG is unset or null, the default value of "C" (see lang(5)) is used. If any of the internationalization variables contains an invalid setting, rm will behave as if all internationalization variables are set to "C". See environ(5). LC_ALL If set to a non-empty string value, overrides the values of all the other internationalization variables. LC_CTYPE determines the interpretation of file names as single and/or multi-byte characters, the classification of characters as printable, and the characters matched by character class expressions in regular expressions. LC_MESSAGES determines the locale that should be used to affect the format and contents of diagnostic messages written to standard error and informative messages written to standard output. NLSPATH determines the location of message catalogues for the processing of LC_MESSAGES. DIAGNOSTICSGenerally self-explanatory. Note that the -f option does not suppress all diagnostic messages. It is forbidden to remove the file .., in order to avoid the consequences of using a command such as: rm -r .* If a designated file is a directory, an error comment is printed unless the -R or -r option is used. RETURN VALUErm exits with one of the following values:
EXAMPLESRemove files with a prompt for verification: rm -i file1 file2 Remove all the files in a directory: rm -i mydirectory/* Note that the previous command removes files only, and does not remove any directories in mydirectory. Remove a file in the current directory whose name starts with - or * or some other character that is special to the shell: rm ./-filename rm \*filename etc. Remove a file in the current directory whose name starts with some strange (usually nonprinting, invisible) character or perhaps has spaces at the beginning or end of the filename, prompting for confirmation: rm -i *filename* If *filename* is not unique in the directory, enter n when each of the other files is prompted. A powerful and dangerous command to remove a directory is: rm -fR directoryname or rm -Rf directoryname which removes all files and directories from directoryname without any prompting for verification to remove the files or the directories. This command should only be used when you are absolutely certain that all the files and directories in directoryname as well as directoryname itself are to be removed. |
Printable version | ||
|