unixdev.net


Switch to SpeakEasy.net DSL

The Modular Manual Browser

Home Page
Manual: (OSF1-V5.1-alpha)
Page:
Section:
Apropos / Subsearch:
optional field



rm(1)									rm(1)



NAME

  rm - Removes (unlinks) files or directories

SYNOPSIS

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

STANDARDS

  Interfaces documented	on this	reference page conform to industry standards
  as follows:

  rm: XCU5.0

  Refer	to the standards(5) reference page for more information	about indus-
  try standards	and associated tags.

OPTIONS

  -e  [Tru64 UNIX]  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
      option 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).

  --  [Tru64 UNIX]  Indicates that all arguments following it are to be
      treated as file names.  This allows you to specify file names starting
      with a - (dash).

OPERANDS

  file
      Path name	of a file or directory to be removed.








DESCRIPTION

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

  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 further with file, and goes	on to any
       remaining files.

   2.  If -f is	not specified and either of the	following is true, rm writes
       a prompt	to standard error and reads a line from	standard input:

	 +  The	permissions of file do not permit writing and standard input
	    is a terminal

	 +  The	-i option is specified

       If the response is affirmative, rm does nothing further with the
       current file and	goes on	to any remaining files.	 (The same actions
       are taken if -f is specified and	file is	not of the directory type.)

   3.  For each	entry contained	in file, other than . (dot) or .. (dot dot)
       entries,	the four steps listed here (1-3) are taken with	the entry as
       if it were a file argument.

  [Tru64 UNIX]	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 or	the
  -i option is specified, 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 option	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	mode
  prompting is not done	when the standard input	is not a terminal.

RESTRICTIONS

  It is	an error to specify . (dot) or ..  (dot	dot) as	the final path name
  component of file, although these entries may	be removed with	the -r or -R
  options.

EXIT STATUS

  The following	exit values are	returned:

  0   If the -f	option was not specified, all the named	directory entries
      were removed; otherwise, all the existing	named directory	entries	were
      removed.

  >>0  An error occurred.





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 file name is displayed, enter	the affirmative	response to
       remove the file;	press <&lt;Return>&gt; (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.

ENVIRONMENT VARIABLES

  The following	environment variables affect the execution of rm:

  LANG
      Provides a default value for the internationalization variables that
      are unset	or null. If LANG is unset or null, the corresponding value
      from the default locale is used.	If any of the internationalization
      variables	contain	an invalid setting, the	utility	behaves	as if none of
      the variables had	been defined.

  LC_ALL
      If set to	a non-empty string value, overrides the	values of all the
      other internationalization variables.

  LC_COLLATE
      Determines the locale for	the behavior of	ranges,	equivalence classes,
      and multicharacter collating elements used in the	extended regular
      expression defined for the yesexpr locale	keyword	in the LC_MESSAGES
      category.

  LC_CTYPE
      Determines the locale for	the interpretation of sequences	of bytes of
      text data	as characters (for example, single-byte	as opposed to multi-
      byte characters in arguments).

      Determines the behavior of character classes in regular expressions
      used in the extended regular espression defined for the yesexpr locale
      keyword in the LC_MESSAGES category.

  LC_MESSAGES
      Determines the locale for	the format and contents	of diagnostic mes-
      sages written to standard	error.

  NLSPATH
      Determines the location of message catalogues for	the processing of
      LC_MESSAGES.




SEE ALSO

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

  Functions:  rmdir(2),	unlink(2), remove(3)

  Standards:  standards(5)