basic UNIX command used to remove objects such as files and directories
The rm utility shall remove the directory entry specified by each file argument. Prompt for confirmation as described previously. Any previous occurrences of the -f option shall be ignored. The standard input shall be used to read an input line in response to each prompt specified in the STDOUT section. Otherwise, the standard input shall not be used. Provide a default value for the internationalization variables that are unset or null. (See XBD Internationalization Variables for the precedence of internationalization variables used to determine the values of locale categories.) If set to a non-empty string value, override the values of all the other internationalization variables. Determine the locale for the behavior of ranges, equivalence classes, and multi-character collating elements used in the extended regular expression defined for the yesexpr locale keyword in the LC MESSAGES category. Determine the locale for the interpretation of sequences of bytes of text data as characters (for example, single-byte as opposed to multi-byte characters in arguments) and the behavior of character classes within regular expressions used in the extended regular expression defined for the yesexpr locale keyword in the LC MESSAGES category. Determine the locale used to process affirmative responses, and the locale used to affect the format and contents of diagnostic messages and prompts written to standard error. [XSI) ] ![[Option Start]]( Determine the location of message catalogs for the processing of LC MESSAGES. ![[Option End]]( Prompts shall be written to standard error under the conditions specified in the DESCRIPTION and OPTIONS sections. The prompts shall contain the file pathname, but their format is otherwise unspecified. The standard error also shall be used for diagnostic messages. Each directory entry was successfully removed, unless its removal was canceled by a non-affirmative response to a prompt for confirmation. Some implementations do not permit the removal of the last link to an executable binary file that is being executed; see the [EBUSY] error in the unlink () function defined in the System Interfaces volume of POSIX.1-2017. Thus, the rm utility can fail to remove such files. The exact format of the interactive prompts is unspecified. Only the general nature of the contents of prompts are specified because implementations may desire more descriptive prompts than those used on historical implementations. Therefore, an application not using the -f option, or using the -i option, relies on the system to provide the most suitable dialog directly with the user, based on the behavior specified. The -r option is historical practice on all known systems. The synonym -R option is provided for consistency with the other utilities in this volume of POSIX.1-2017 that provide options requesting recursive descent through the file hierarchy. It is less clear that error messages regarding files that cannot be unlinked (removed) should be suppressed. Although this is historical practice, this volume of POSIX.1-2017 does not permit the -f option to suppress such messages. When given the -r and -i options, historical versions of rm prompt the user twice for each directory, once before removing its contents and once before actually attempting to delete the directory entry that names it. This allows the user to "prune" the file hierarchy walk. Historical versions of rm were inconsistent in that some did not do the former prompt for directories named on the command line and others had obscure prompting behavior when the -i option was specified and the permissions of the file did not permit writing. The POSIX Shell and Utilities rm differs little from historic practice, but does require that prompts be consistent. Historical versions of rm were also inconsistent in that prompts were done to both standard output and standard error. This volume of POSIX.1-2017 requires that prompts be done to standard error, for consistency
Excerpt from a page describing this subject · 14,742 chars · not written by Vinony
via Wikidata · CC0
via Wikidata sitelinks · CC0
Discovered by embedding cosine similarity (sentence-transformers MiniLM, 384-dim).