Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

link(1M)

unlink(2)

RM(1)  —  Silicon Graphics

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.  Symbolic links are not followed. 

If the −i (interactive) option is in effect, rm asks whether to delete each file, and, under −r, whether to examine each directory. 

Rm accepts flags as separate or combined arguments.  An argument consisting solely of − will cause rm to treat any occurrence of a − in a following argument as part of a file name. 

Rmdir removes entries for the named directories, which must be empty. 

EXAMPLES

rm −r dirname

will remove the entire contents of the named directory and all subdirectories, and finally the directory itself, with no questions asked. 

rm −ri dirname
rm −r −i dirname

will recursively and interactively remove the tree rooted at dirname.

rm −i − −f

will interactively remove the tree rooted at −f.

SEE ALSO

link(1M), unlink(2). 

DIAGNOSTICS

Generally self-explanatory.  Exit status is non-zero if an attempt to remove a file fails and the −f flag is not supplied.  It is forbidden to remove the file .. merely to avoid the antisocial consequences of inadvertently doing something like:

rm −r .∗

Version 2.5r1  —  October 29, 1986

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026