System Administration Guide

Checking the Size of Directories

You can display the size of directories by using the du command and its options. Additionally, you can find the amount of disk space taken up by user accounts on local UFS file systems by using the quot command. For more information about these commands, see du(1M)and quot(1M).

How to Display the Size of Directories, Subdirectories, and Files

Display the size of one or more directories, subdirectories, and files by using the du command. Sizes are displayed in 512-byte blocks.


$ du [-as] [directory ...]

du

Displays the size of each directory you specify, including each subdirectory beneath it. 

-a

Displays the size of each file and subdirectory, and the total number of blocks contained in the specified directory. 

-s

Displays only the total number of blocks contained in the specified directory. 

directory ...

Specifies one or more directories you want to check. 

Examples--Displaying the Size of Directories, Subdirectories, and Files

The following example displays the sizes of two directories and all the subdirectories they contain.


$ du /var/log /var/cron
4       /var/log
3250    /var/cron

The following example displays the sizes of two directories, all of the subdirectories and files they contain, and the total number of blocks contained in each directory.


$ du -a /var/log /var/cron
0       /var/log/authlog
0       /var/log/syslog
2       /var/log/sysidconfig.log
4       /var/log
3248    /var/cron/log
3250    /var/cron

The following example displays the total sizes of two directories.


$ du -s /var/log /var/cron
4      /var/log
3250   /var/cron

How to Display the User Allocation of Local UFS File System

  1. Become superuser.

  2. 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

    Is 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 Allocation 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:
35400   bin
14312   smtp
  183   adm
   49   lp
   47   uucp
   37   bob
   28   sys
    2   mary
# quot -a
/dev/rdsk/c0t0d0s0 (/):
35400   bin
14312   smtp
  183   adm
   49   lp
   47   uucp
   37   bob
   28   sys
    2   mary
/dev/rdsk/c0t0d0s6 (/usr):
104276  smtp
56567   bin
 2000   lp
  698   uucp
    1   adm
/dev/rdsk/c0t0d0s7 (/export/home):
  617   smtp