System Administration Guide: Advanced Administration

ProcedureHow to Clear Out Temporary Directories

  1. Become superuser or assume an equivalent role.

    Roles contain authorizations and privileged commands. For more information about roles, see Configuring RBAC (Task Map) in System Administration Guide: Security Services.

  2. Change to the directory that you want to clean out.


    # cd directory
    

    Caution – Caution –

    Ensure that you are in the correct 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 that contain unnecessary, temporary or obsolete subdirectories and files. Delete these subdirectories and files by repeating Step 3.


Example 6–12 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
#