rm.1 (2010 09)

r
rm(1) rm(1)
NAME
rm - remove files or directories
SYNOPSIS
rm [-f-i][-Rr
] file ...
DESCRIPTION
The
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 per-
mit 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.
Options
rm recognizes the following options:
-f Force each file or directory to be removed without prompting for confirmation, regardless of
the permissions of the entry. This option also suppresses diagnostic messages regarding
nonexistent operands.
This option does not suppress any diagnostic messages other than those regarding nonexistent
operands. To suppress all error message and interactive prompts, the
-f option should be
used while redirecting standard error output to /dev/null.
This option ignores any previous occurrence of the
-i option.
-i Write a prompt to standard error requesting confirmation before removing each entry.
This option ignores any previous occurrence of the
-f option.
-R For each argument that is a directory, this option causes rm to recursively delete the entire
contents of that directory before removing the directory itself. When used in conjunction with
the -i option, rm asks whether to examine each directory before interactively removing files
in that directory and again afterward to confirm removing the directory itself.
The
-R option will descend to arbitrary depths in a file hierarchy and will not fail due to path
length limitations unless the length of file name, file specified by the user exceeds system
limitations.
-r Equivalent to -R.
Access Control Lists
If a file has optional
ACL entries, rm displays a plus sign (+) after the file’s permissions. The permissions
shown summarize the file’s st_mode value returned by stat() (see stat (2)). See also acl (5).
EXTERNAL INFLUENCES
Environment Variables
LANG 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 vari-
ables.
HP-UX 11i Version 3: September 2010 1 Hewlett-Packard Company 1

Summary of content (4 pages)