*** UNIX MANUAL PAGE BROWSER ***

A Nergahak database for man pages research.

Navigation

Directory Browser

1Browse 4.4BSD4.4BSD
1Browse Digital UNIXDigital UNIX 4.0e
1Browse FreeBSDFreeBSD 14.3
1Browse MINIXMINIX 3.4.0rc6-d5e4fc0
1Browse NetBSDNetBSD 10.1
1Browse OpenBSDOpenBSD 7.7
1Browse UNIX v7Version 7 UNIX
1Browse UNIX v10Version 10 UNIX

Manual Page Search

Manual Page Result

0 Command: rm | Section: 1 | Source: Digital UNIX | File: rm.1.gz
rm(1) General Commands Manual rm(1) NAME rm - Removes (unlinks) files or directories SYNOPSIS rm [-efirR] [--] file... STANDARDS Interfaces documented on this reference page conform to industry stan- dards as follows: rm: XPG4, XPG4-UNIX Refer to the standards(5) reference page for more information about in- dustry standards and associated tags. OPTIONS [DIGITAL] Displays a message after deleting each file. Does not prompt before removing a file that does not have write permission set, and does not display an error message if a specified file does not ex- ist. If you specify both -f and -i when invoking rm, the option that is specified last on the command line takes effect. Prompts you before deleting each file (interactive). When you use both -i and -r, rm also prompts for removing each file, then the directory. If you specify both -f and -i with rm, the last one on the command line takes effect. Per- mits recursive removal of directories and their contents (for cases where file is a directory). Permits recursive removal of directories and their contents (for cases where file is a directory, same as -r). [DIGITAL] Indicates that all arguments following it are to be treated as file names. This allows you to specify file names starting with a - (dash). OPERANDS Path name of a file or directory to be removed. DESCRIPTION The rm command removes the entries for the specified files from a di- rectory. If file is of the directory type: If you specify neither -R or -r, rm writes a diagnostic message to standard error, does nothing further with file, and goes on to any remaining files. If -f is not specified and either of the following is true, rm writes a prompt to standard er- ror and reads a line from standard input: The permissions of file do not permit writing and standard input is a terminal The -i option is specified If the response is affirmative, rm does nothing further with the current file and goes on to any remaining files. (The same ac- tions are taken if -f is specified and file is not of the direc- tory type.) For each entry contained in file, other than (dot) or (dot dot) entries, the four steps listed here (1-3) are taken with the entry as if it were a file argument. [DIGITAL] If an entry is the last link to a file, it is destroyed. To remove a file, you must have write permission for its parent directory, but need neither read nor write permission for the file itself. If the sticky bit on the directory is set, you must be the owner of the file or superuser. If a file has no write permission and standard input is a terminal or the -i option is specified, rm displays the file permission code and reads a line from standard input. If that line begins with y, or the locale's equivalent of a y, rm deletes the file. If the response is anything else, rm does nothing to that file and continues with the next specified file. The LC_MESSAGES variable determines the locale's equivalent of y or n (for yes/no queries). The -i option causes rm to prompt and read the standard input even if the standard input is not a terminal. In the absence of -i, however, the mode prompting is not done when the standard input is not a termi- nal. RESTRICTIONS It is an error to specify . (dot) or .. (dot dot) as the final path name component of file, although these entries may be removed with the -r or -R options. EXIT STATUS The following exit values are returned: If the -f option was not speci- fied, all the named directory entries were removed; otherwise, all the existing named directory entries were removed. An error occurred. EXAMPLES To delete a file, enter: rm myfile If there is another link to this file, then the file remains un- der that name, but myfile is removed. If myfile is the only link, the file itself is deleted. To delete a file silently, enter: rm -f core This removes core without asking any questions or displaying any error messages. This is normally used in shell procedures. It prevents confusing messages from being displayed when deleting files that may or may not exist. To delete files interactively, enter: rm -i mydir/* After each file name is displayed, enter the affirmative re- sponse to remove the file; press <Return> (or anything other than the affirmative response) to retain the file. To delete a directory tree interactively, enter: rm -ir manual This recursively removes the contents of all subdirectories of manual, then removes manual itself, asking if you want to remove each file and directory. ENVIRONMENT VARIABLES The following environment variables affect the execution of rm: Pro- vides a default value for the internationalization variables that are unset or null. If LANG is unset or null, the corresponding value from the default locale is used. If any of the internationalization vari- ables contain an invalid setting, the utility behaves as if none of the variables had been defined. If set to a non-empty string value, over- rides the values of all the other internationalization variables. De- termines the locale for the behavior of ranges, equivalence classes, and multicharacter collating elements used in the extended regular ex- pression defined for the yesexpr locale keyword in the LC_MESSAGES cat- egory. Determines the locale for the interpretation of sequences of bytes of text data as characters (for example, single-byte as opposed to multibyte characters in arguments). Determines the behavior of character classes in regular expres- sions used in the extended regular espression defined for the yesexpr locale keyword in the LC_MESSAGES category. Determines the locale for the format and contents of diagnostic messages written to standard error. Determines the location of message catalogues for the processing of LC_MESSAGES. SEE ALSO Commands: ln(1), mv(1), rmdir(1) Functions: rmdir(2), unlink(2), remove(3) Standards: standards(5) rm(1)

Navigation Options