Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ rm(1) — AIX/RT 2.2.1

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

del

ln

unlink

rm

PURPOSE

     Removes files or directories.

SYNOPSIS
     rm [ -fri ] file ...

     rmdir dir ...


DESCRIPTION

     The  rm (delete)  command removes  the entries  for files
     from a  directory.  If  an entry  is the  last link  to a
     file, it is  destroyed.  To remove a file,  you must have
     write permission  in its directory, but  neither read nor
     write permission for the file itself if you own it or are
     acting with superuser authority.

     If a file has no write permission and standard input is a
     work station,  rm displays  the file permission  code and
     reads a  line from standard  input.  If that  line begins
     with "y", rm deletes the file; otherwise it remains.

FLAGS

     -f Does  not  prompt  before removing  a  write-protected
        file.
     -i Prompts you  before deleting each file.   When you use
        both -i and  -r together, rm also asks if  you want to
        examine directories.
     -r Permits  recursive removal  of  directories and  their
        contents (for cases where file is a directory).

EXAMPLES

     1.  To delete a file:

           rm  myfile

         If there is another link  to this file, then the file
         remains  under that  name, but  the name  "myfile" is
         removed.   If "myfile"  is  the only  link, the  file
         itself is deleted.
     2.  To delete a file silently:

           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 one by one:

           rm  -i  mydir/*

         This  interactively asks  you if  you want  to remove
         each file.  After each  file name is displayed, enter
         "y" to delete the file,  or press Enter alone to keep
         it.
     4.  To delete a directory tree:

           rm  -ir  manual

         This recursively  removes the contents of  all subdi-
         rectories of "manual",  then removes "manual" itself,
         asking if you want to remove each file.  For example:

            You:
              rm  -ir  manual
         System:
              directory manual:
            You:
              y
         System:
              directory manual/draft1:
            You:
              y
         System:
              manual/draft1/chapter1:
            You:
              y
         System:
              manual/draft1/chapter2:
            You:
              y
         System:
              manual/draft1:
            You:
              y
         System:
              directory manual/draft2
            You:
              y
         System:
              manual/draft2:
            You:
              n
         System:
              manual:
            You:
              y

         Here,  rm first  asks if  you want  it to  search the
         directory "manual".  Because "manual" contains direc-
         tories,  rm  next  asks   for  permission  to  search
         "manual/draft1" for files to delete, and then asks if
         you     want    it     to     delete    the     files
         "manual/draft1/chapter1"                          and
         "manual/draft1/chapter2".  rm  next asks  for permis-
         sion  to search  the  directory "manual/draft2",  and
         then asks  for permission  to delete  the directories
         "manual/draft1",   "manual/draft2",   and   "manual".
         Because    you    denied   permission    to    remove

         "manual/draft2",   rm  will   not  remove   "manual".
         Instead, you will see  the message "rmdir: manual not
         empty".

RELATED INFORMATION

     The following commands:  "del" and "ln."

     The unlink system call  in AIX Operating System Technical
     Reference.

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