rm(1)									rm(1)



NAME

  rm - Removes (unlinks) files or directories

SYNOPSIS

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

  The rm command removes the entries for the specified files from a direc-
  tory.

FLAGS

  -e  Displays a message after deleting each file.

  -f  Does not prompt before removing a file that does not have write permis-
      sion set, and does not display an error message if a specified file
      does not exist. If you specify both -f and -i when invoking rm, the
      flag that is specified last on the command line takes effect.

  -i  Prompts you before deleting each file (interactive).  When you use both
      -i and -r, rm also prompts for removing each file, then the directory.
      If you specify both -f and -i with rm, the last one on the command line
      takes effect.

  -r  Permits recursive removal of directories and their contents (for cases
      where file is a directory).

  -R  Permits recursive removal of directories and their contents (for cases
      where file is a directory, same as -r).

  --  Indicates that all arguments following it are to be treated as
      filenames.  This allows you to specify filenames starting with a -
      (dash).

DESCRIPTION

  If file is of the directory type:

   1.  If you specify neither -R or -r , rm writes a diagnostic message to
       standard error, does nothing more with file, and goes on to any
       remaining files.

   2.  If you specify -f, rm does not remove file, and does not print a diag-
       nostic message unless file is . (dot) or ..  (dot dot), which it can-
       not remove.

  If an entry is the last link to a file, it is destroyed.  To remove a file,
  you must have write permission for its parent directory, but need neither
  read nor write permission for the file itself.  If the sticky bit on the
  directory is set, you must be the owner of the file or superuser.


  If a file has no write permission and standard input is a terminal, rm
  displays the file permission code and reads a line from standard input.  If
  that line begins with y, or the locale's equivalent of a y, rm deletes the
  file.	 If the response is anything else, rm does nothing to that file and
  continues with the next specified file.

  The LC_MESSAGES variable determines the locale's equivalent of y or n (for
  yes/no queries).

  The -i flag causes rm to prompt and read the standard input even if the
  standard input is not a terminal.  In the absence of -i, however, the
  prompting is not done when the standard input is not a terminal.

EXAMPLES

   1.  To delete a file, enter:
	    rm	myfile


       If there is another link to this file, then the file remains under
       that name, but myfile is removed.  If myfile is the only link, the
       file itself is deleted.

   2.  To delete a file silently, enter:
	    rm	-f  core


       This removes core without asking any questions or displaying any error
       messages.  This is normally used in shell procedures.  It prevents
       confusing messages from being displayed when deleting files that may
       or may not exist.

   3.  To delete files interactively, enter:
	    rm	-i  mydir/*


       After each filename is displayed, enter the affirmative response to
       remove the file; press  (or anything other than the affirma-
       tive response) to retain the file.

   4.  To delete a directory tree interactively, enter:
	    rm	-ir  manual


       This recursively removes the contents of all subdirectories of manual,
       then removes manual itself, asking if you want to remove each file and
       directory.

RELATED INFORMATION

  Commands:  ln(1), mv(1), rmdir(1).

  Functions:  rmdir(2), unlink(2).