The following example shows directory sizes in 1024 bytes.
du -h /usr/share/audio 796K /usr/share/audio/samples/au 797K /usr/share/audio/samples 798K /usr/share/audio |
How to Display the User Ownership of Local UFS File Systems
Display users, directories, or file systems, and the number of 1024-byte blocks used.
# quot [-a] [filesystem]
-a
Lists all users of each mounted UFS file system and the number of 1024-byte blocks used.
filesystem
Identifies a UFS file system. Users and the number of blocks used are displayed.
Note - The quot command works only on local UFS file systems.
Example--Displaying the User Ownership of Local UFS File Systems
In the following example, users of the root (/) file system are displayed. Then, users of all mounted UFS file systems are displayed.
# quot / /dev/rdsk/c0t0d0s0: 43340 root 3142 rimmer 47 uucp 35 lp 30 adm 4 bin 4 daemon # quot -a /dev/rdsk/c0t0d0s0 (/): 43340 root 3150 rimmer 47 uucp 35 lp 30 adm 4 bin 4 daemon /dev/rdsk/c0t0d0s6 (/usr): 460651 root 206632 bin 791 uucp 46 lp 4 daemon 1 adm /dev/rdsk/c0t0d0s7 (/export/home): 9 root |
Finding and Removing Old or Inactive Files
Part of the job of cleaning up heavily loaded file systems involves locating and removing files that have not been used recently. You can locate unused files using the ls or find commands. For more information, see ls(1) and find(1).
Other ways to conserve disk space include emptying temporary directories such as the ones located in /var/tmp or /var/spool, and deleting core and crash dump files. For more information about crash dump files, refer to Chapter 28, Managing System Crash Information (Tasks).
How to List the Newest Files
List files, displaying the most recently created or changed files first, by using the ls -t command.
$ ls -t [directory] |
-t | Sorts files by latest time stamp first. |
directory | Identifies the directory you want to search. |
Example--Listing the Newest Files
The following example shows how to use the ls -tl command to locate the most recently created or changed files within the /var/adm directory. The sulog file was created or edited most recently.
$ ls -tl /var/adm total 134 -rw------- 1 root root 315 Sep 24 14:00 sulog -r--r--r-- 1 root other 350700 Sep 22 11:04 lastlog -rw-r--r-- 1 root bin 4464 Sep 22 11:04 utmpx -rw-r--r-- 1 adm adm 20088 Sep 22 11:04 wtmpx -rw-r--r-- 1 root other 0 Sep 19 03:10 messages -rw-r--r-- 1 root other 0 Sep 12 03:10 messages.0 -rw-r--r-- 1 root root 11510 Sep 10 16:13 messages.1 -rw-r--r-- 1 root root 0 Sep 10 16:12 vold.log drwxr-xr-x 2 root sys 512 Sep 10 15:33 sm.bin drwxrwxr-x 5 adm adm 512 Sep 10 15:19 acct drwxrwxr-x 2 adm sys 512 Sep 10 15:19 sa -rw------- 1 uucp bin 0 Sep 10 15:17 aculog -rw-rw-rw- 1 root bin 0 Sep 10 15:17 spellhist drwxr-xr-x 2 adm adm 512 Sep 10 15:17 log drwxr-xr-x 2 adm adm 512 Sep 10 15:17 passwd |
How to Find and Remove Old or Inactive Files
Become superuser.
Find files that have not been accessed for a specified number of days and list them in a file.
# find directory -type f[-atime + nnn] [-mtime + nnn] -print > filename
Remove the inactive files that you listed in the previous step.
# rm `cat filename`
filename identifies the file created in the previous step which contains the list of inactive files.
Example--Finding and Removing Old or Inactive Files
The following example shows files in the /var/adm directory and the subdirectories that have not been accessed in the last 60 days. The /var/tmp/deadfiles file contains the list of inactive files. The rm command removes these inactive files.
# find /var/adm -type f -atime +60 -print > /var/tmp/deadfiles & # more /var/tmp/deadfiles /var/adm/aculog /var/adm/spellhist /var/adm/wtmpx /var/adm/sa/sa13 /var/adm/sa/sa27 /var/adm/sa/sa11 /var/adm/sa/sa23 /var/adm/sulog /var/adm/vold.log /var/adm/messages.1 /var/adm/messages.2 /var/adm/messages.3 # rm `cat /var/tmp/deadfiles` # |