Sun Microsystems, Inc.
spacerspacer
spacer www.sun.com docs.sun.com |
spacer
black dot
 
 
16.  Managing Disk Use (Tasks) Finding and Removing Old or Inactive Files How to Find and Remove Old or Inactive Files Example--Finding and Removing Old or Inactive Files  Previous   Contents   Next 
   
 

How to Clear Out Temporary Directories

  1. Become superuser.

  2. Change to the directory to clean out.

    # cd directory

    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
#

How to Find and Delete core Files

  1. Become superuser.

  2. Change to the directory where you want to search for core files.

  3. Find and remove any core files in this directory and its subdirectories.

    # find . -name core -exec rm {} \;

Example--Finding and Deleting core Files

The following example shows how to find and remove core files from the jones user account by using the find command.

# cd /home/jones# find . -name core -exec rm {} \;

How to Delete Crash Dump Files

Crash dump files can be very large, so if you have enabled your system to store these files, do not retain them for longer than necessary.

  1. Become superuser.

  2. Change to the directory where crash dump files are stored.

    # cd /var/crash/system

    Where system identifies a system that created the crash dump files.


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


  3. Remove the crash dump files.

    # rm *
  4. Verify that the crash dump files are removed.

    # ls

Example--Deleting Crash Dump Files

The following example shows how to remove crash dump files from the system venus, and how to verify that the crash dump files were removed.

# cd /var/crash/venus
# rm *
# ls
 
 
 
  Previous   Contents   Next