rm

Official Description

Removes (unlinks) files or directories.

Syntax

rm [-efirR] [--] file...
				

Options

-f forces the deletion of the file with no prompting and no error messages (good for script use).

-i prompts you before deleting each file.

-r permits the recursive removal of directories and their contents.

-- allows filenames beginning with -.

Oddities

Only when a filename is the last link to a file is the storage actually deallocated.

Example

$ ln buzz8 buzz9             # Create a link to buzz8's data
$
$ ln buzz8 buzz10            # Create another link to buzz8's data
$
$ ls -l buzz[891]*           # Note link count
-r-x-w-r-x   3 obrien   users          47 Nov 27 13:31 buzz10
-r-x-w-r-x   3 obrien   users          47 Nov 27 13:31 buzz8
-r-x-w-r-x   3 obrien users 47 Nov 27 13:31 buzz9 $ $ rm ...

Get Korn Shell Programming by Example now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.