RM(1) — HP-UX
NAME
rm, rmdir − remove files or directories
SYNOPSIS
rm [ −fri ] file ...
rmdir dir ...
DESCRIPTION
Rm 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 permission in its directory, but neither read nor write permission on the file itself.
If a file has no write permission and the standard input is a terminal, its permissions are printed and a line is read from the 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 the standard input is not a terminal.
If a designated file is a directory, an error comment is printed unless the optional argument −r has been used. In that case, rm recursively deletes the entire contents of the specified directory, and the directory itself. (Note that rm can recursively remove a maximum of 17 directory levels.)
If the −i (interactive) option is in effect, rm asks whether to delete each file, and, under −r, whether to examine each directory.
Rmdir removes entries for the named directories, which must be empty.
EXAMPLES
To remove files with a prompt for verification:
rm -i filenames
To remove an empty directory, type:
rmdir directoryname
To remove all the files in a directory type:
rm -i directoryname/*
Note that the above command removes files only, and leaves any directories in directoryname alone.
A powerful and dangerous command to remove a directory would be:
rm -rf directoryname
This command removes all files and directories from directoryname without prompting for verification to remove the files nor the directories. Therefore, this command should only be used when you are absolutely sure that all the files and directories in directoryname and directoryname itself are to be removed.
SEE ALSO
DIAGNOSTICS
Generally self-explanatory. It is forbidden to remove the file .. merely to avoid the consequences of inadvertently doing something like:
rm −r .∗
INTERNATIONAL SUPPORT
8- and 16-bit data, 8-bit file names, messages.
Hewlett-Packard Company — Version B.1, May 11, 2021