System Administration Guide: Advanced Administration

How to Clear Out Temporary Directories

  1. Become superuser.

  2. Change to the directory to clean out.


    # cd directory
    

    Caution – Caution –

    Be sure you are in the right directory before completing step 3. Step 3 deletes all files in the current directory.


  3. Delete the files and subdirectories in the current directory.


    # rm -r *
    
  4. Change to other directories containing unnecessary temporary or obsolete subdirectories and files, and delete them by repeating Step 3.

Example—Clearing Out Temporary Directories

The following example shows how to clear out the mywork directory, and how to verify that all files and subdirectories were removed.


# cd mywork
# ls
filea.000
fileb.000
filec.001
# rm -r *
# ls
#