DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 
Managing files

Removing files

Removing files you no longer need is an important part of managing the way you work on the computer. Any computer has a limited amount of disk space, and, although the computer may have a very large hard disk, eventually the disk begins to fill. To do your part in not adding to computer ``litter,'' you should regularly remove files you no longer need.

To remove a file, type rm, the name of the file, and press <Enter>. You can quickly remove a directory and all the subdirectories below it with the command rm -rf *. This command recursively removes everything in its path, asking no questions as it goes. Be careful with it.

Try creating a file and then removing it:

  1. Type cd and press <Enter> to go to your home directory.

  2. Use the touch command to create a file. Type touch newfile and press <Enter> to create a file 0 bytes long.

  3. List the file by typing l newfile and pressing <Enter>.

  4. Remove newfile by typing rm newfile and pressing <Enter>.

  5. Check that you removed the file by typing l newfile and pressing <Enter>. The computer responds with newfile not found.
    $ cd
    $ touch newfile
    $ l newfile
    -rw-r--r--  1 susannah techpubs     0 Jul 12 13:59 newfile
    $ rm newfile
    $ l newfile
    newfile not found
    

Q: What if I see a message like file: 600 mode?

A: If you try to remove a file on which you do not have write permission, rm prints the filename followed by the permission mode of the file. This is the rm command's way of asking you if you are sure you want to remove the file. Type y to remove the file, or n to leave it as it is. For more information about permissions, see ``Protecting files and directories''.


Next topic: Summary
Previous topic: mv mydir/afile /tmp

© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003