<chapter id="sysresdiskuse-61891"><title>Managing Disk Use (Tasks)</title><highlights><para>This chapter describes how to optimize disk space by locating unused
files and large directories.</para><para>For information on the procedures associated with managing disk use,
see <olink targetptr="enfmy" remap="internal">Managing Disk Use (Task Map)</olink>.</para>
</highlights><sect1 id="enfmy"><title>Managing Disk Use (Task Map)</title><informaltable frame="all"><tgroup cols="3" colsep="1" rowsep="1"><colspec colwidth="33*"/><colspec colwidth="33*"/><colspec colwidth="33*"/><thead><row><entry><para>Task</para>
</entry><entry><para>Description</para>
</entry><entry><para>For Instructions</para>
</entry>
</row>
</thead><tbody><row><entry rowsep="1"><para>Display information about files and disk space.</para>
</entry><entry rowsep="1"><para>Display information about how disk space is used by using the <command>df</command> command.</para>
</entry><entry colsep="0" rowsep="1"><para><olink targetptr="enfnc" remap="internal">How to Display Information About Files and
Disk Space</olink></para>
</entry>
</row><row><entry rowsep="1"><para>Display the size of files.</para>
</entry><entry rowsep="1"><para>Display information about the size of files by using the <command>ls</command> command
with the <option>lh</option> options.</para>
</entry><entry rowsep="1"><para><olink targetptr="sysresdiskuse-40204" remap="internal">How to Display the Size of Files</olink></para>
</entry>
</row><row><entry rowsep="1"><para>Find large files.</para>
</entry><entry rowsep="1"><para>The <command>ls</command> <option>s</option> command allows you to sort
files by size, in descending order.</para>
</entry><entry rowsep="1"><para><olink targetptr="sysresdiskuse-24569" remap="internal">How to Find Large Files</olink></para>
</entry>
</row><row><entry rowsep="1"><para>Find files that exceed a specified size limit.</para>
</entry><entry rowsep="1"><para>Locate and display the names of files that exceed a specified size by
using the <command>find</command> command with the <option>size</option> option
and the value of the specified size limit.</para>
</entry><entry rowsep="1"><para><olink targetptr="enmwy" remap="internal">How to Find Files That Exceed a Specified Size
Limit</olink></para>
</entry>
</row><row><entry><para>Display the size of directories, subdirectories, and files.</para>
</entry><entry><para>Display the size of one or more directories, subdirectories, and files
by using the <command>du</command> command. </para>
</entry><entry><para><olink targetptr="enmwv" remap="internal">How to Display the Size of Directories, Subdirectories,
and Files</olink></para>
</entry>
</row><row><entry><para>Display ownership of local UFS file systems.</para>
</entry><entry><para>Display ownership of files by using the <command>quot</command> <option>a</option> command.</para>
</entry><entry><para><olink targetptr="sysresdiskuse-87953" remap="internal">How to Display the User Ownership
of Local UFS File Systems</olink></para>
</entry>
</row><row><entry><para>List the newest files.</para>
</entry><entry><para>Display the most recently created or changed files first, by using the <command>ls</command> <option>t</option> command</para>
</entry><entry colsep="0" rowsep="1"><para><olink targetptr="enmxb" remap="internal">How to List the Newest Files</olink></para>
</entry>
</row><row><entry><para>Find and remove old or inactive files.</para>
</entry><entry><para>Use the <command>find</command> command with the <option>atime</option> and <option>mtime</option> options to locate files that have not been accessed for a specified
number of days. You can remove these files by using the<command>rm `cat <replaceable>filename</replaceable>'</command> command.</para>
</entry><entry rowsep="1"><para><olink targetptr="sysresdiskuse-10372" remap="internal">How to Find and Remove Old or
Inactive Files</olink></para>
</entry>
</row><row><entry><para>Clear out temporary directories.</para>
</entry><entry><para>Locate temp directories, then use the <command>rm <option>r</option> *</command> command
to remove the entire directory.</para>
</entry><entry><para><olink targetptr="sysresdiskuse-83518" remap="internal">How to Clear Out Temporary Directories</olink></para>
</entry>
</row><row><entry><para>Find and delete core files.</para>
</entry><entry><para>Find and delete core files by using the <command>find . -name core -exec
rm {} \;</command> command.</para>
</entry><entry><para><olink targetptr="sysresdiskuse-85712" remap="internal">How to Find and Delete core Files</olink></para>
</entry>
</row><row><entry><para>Delete crash dump files.</para>
</entry><entry><para>Delete crash dump files that are located in the <filename>/var/crash/</filename> directory
by using the <command>rm *</command> command.</para>
</entry><entry><para><olink targetptr="sysresdiskuse-45392" remap="internal">How to Delete Crash Dump Files</olink></para>
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</sect1><sect1 id="sysresdiskuse-1"><title>Displaying Information About Files and
Disk Space</title><para>This table summarizes the commands available for displaying information
about file size and disk space. </para><informaltable frame="topbot"><tgroup cols="3" colsep="0" rowsep="0"><colspec colname="colspec2" colwidth="33*"/><colspec colname="colspec4" colwidth="33*"/><colspec colname="colspec1" colwidth="33.00*"/><thead><row rowsep="1"><entry><para>Command</para>
</entry><entry><para>Description</para>
</entry><entry><para>Man Page</para>
</entry>
</row>
</thead><tbody><row><entry><para><command>df</command></para>
</entry><entry><para>Reports the number of free disk blocks and files</para>
</entry><entry><para><olink targetdoc="refman" targetptr="df-1m" remap="external"><citerefentry><refentrytitle>df</refentrytitle><manvolnum>1M</manvolnum></citerefentry></olink></para>
</entry>
</row><row><entry><para><command>du</command></para>
</entry><entry><para>Summarizes disk space allocated to each subdirectory</para>
</entry><entry><para><olink targetdoc="refman" targetptr="du-1" remap="external"><citerefentry><refentrytitle>du</refentrytitle><manvolnum>1</manvolnum></citerefentry></olink></para>
</entry>
</row><row><entry><para><command>find</command> <option>size</option></para>
</entry><entry><para>Searches recursively through a directory based on the size specified
with the <option>size</option> option</para>
</entry><entry><para><olink targetdoc="refman" targetptr="find-1" remap="external"><citerefentry><refentrytitle>find</refentrytitle><manvolnum>1</manvolnum></citerefentry></olink></para>
</entry>
</row><row><entry><para><command>ls</command> <option>lh</option></para>
</entry><entry><para>Lists the size of a file in the power of 1024 scaling</para>
</entry><entry><para><olink targetdoc="refman" targetptr="ls-1" remap="external"><citerefentry><refentrytitle>ls</refentrytitle><manvolnum>1</manvolnum></citerefentry></olink></para>
</entry>
</row>
</tbody>
</tgroup>
</informaltable><task id="enfnc"><title>How to Display Information About Files and Disk Space</title><procedure remap="single-step"><step><para>Display information about how disk space is used by using the <command>df</command> command.   </para><screen>$ <userinput>df</userinput> [<replaceable>directory</replaceable>]  [<userinput>-h</userinput>] [<userinput>-t</userinput>]</screen><variablelist><varlistentry><term><command>df</command></term><listitem><para>With no options, lists all mounted file systems and their
device names, the number of 512-byte blocks used, and the number of files.</para>
</listitem>
</varlistentry><varlistentry><term><replaceable>directory</replaceable></term><listitem><para>Specifies the directory whose file system you want to check.</para>
</listitem>
</varlistentry><varlistentry><term><option>h</option></term><listitem><para>Displays disk space in the power of 1024 scaling.</para>
</listitem>
</varlistentry><varlistentry><term><option>t</option></term><listitem><para>Displays the total blocks as well as the blocks used for all
mounted file systems.</para>
</listitem>
</varlistentry>
</variablelist>
</step>
</procedure><example id="eezei"><title>Displaying Information About File Size and Disk Space</title><para>In the following example, all the file systems listed are locally
mounted except for <filename>/usr/dist</filename>, which is mounted remotely
from the system <literal>venus</literal>.</para><screen>$ <userinput>df</userinput>
/                  (/dev/dsk/c0t0d0s0 ):  101294 blocks   105480 files
/devices           (/devices          ):       0 blocks        0 files
/system/contract   (ctfs              ):       0 blocks 2147483578 files
/proc              (proc              ):       0 blocks     1871 files
/etc/mnttab        (mnttab            ):       0 blocks        0 files
/etc/svc/volatile  (swap              ):  992704 blocks    16964 files
/system/object     (objfs             ):       0 blocks 2147483530 files
/usr               (/dev/dsk/c0t0d0s6 ):  503774 blocks   299189 files
/dev/fd            (fd                ):       0 blocks        0 files
/var/run           (swap              ):  992704 blocks    16964 files
/tmp               (swap              ):  992704 blocks    16964 files
/opt               (/dev/dsk/c0t0d0s5 ):   23914 blocks     6947 files
/export/home       (/dev/dsk/c0t0d0s7 ):   16810 blocks     7160 files</screen>
</example><example id="enfnb"><title>Displaying File Size Information in 1024 Bytes</title><para>In the following example, file system information is displayed
in 1024 bytes.</para><screen>$ <userinput>df -h</userinput>
Filesystem             size   used  avail capacity  Mounted on
/dev/dsk/c0t0d0s0      249M   200M    25M    90%    /
/devices                 0K     0K     0K     0%    /devices
ctfs                     0K     0K     0K     0%    /system/contract
proc                     0K     0K     0K     0%    /proc
mnttab                   0K     0K     0K     0%    /etc/mnttab
swap                   485M   376K   485M     1%    /etc/svc/volatile
objfs                    0K     0K     0K     0%    /system/object
/dev/dsk/c0t0d0s6      3.2G   2.9G   214M    94%    /usr
fd                       0K     0K     0K     0%    /dev/fd
swap                   485M    40K   485M     1%    /var/run
swap                   485M    40K   485M     1%    /tmp
/dev/dsk/c0t0d0s5       13M   1.7M    10M    15%    /opt
/dev/dsk/c0t0d0s7      9.2M   1.0M   7.3M    13%    /export/home</screen><para>Although <filename>/proc</filename> and <filename>/tmp</filename> are
local file systems, they are not UFS file systems. <filename>/proc</filename> is
a PROCFS file system, <filename>/var/run</filename> and <filename>/tmp</filename> are
TMPFS file systems, and <filename>/etc/mnttab</filename> is an MNTFS file
system.</para>
</example><example id="enfmw"><title>Displaying Total Number of Blocks and Files Allocated for a File System</title><para>The following example shows a list of all mounted file systems,
device names, total 512-byte blocks used, and the number of files. The second
line of each two-line entry displays the total number of blocks and files
that are allocated for the file system.</para><screen>$ <userinput>df -t</userinput>
/                  (/dev/dsk/c0t0d0s0 ):   101294 blocks   105480 files
                                  total:   509932 blocks   129024 files
/devices           (/devices          ):        0 blocks        0 files
                                  total:        0 blocks      113 files
/system/contract   (ctfs              ):        0 blocks 2147483578 files
                                  total:        0 blocks       69 files
/proc              (proc              ):        0 blocks     1871 files
                                  total:        0 blocks     1916 files
/etc/mnttab        (mnttab            ):        0 blocks        0 files
                                  total:        0 blocks        1 files
/etc/svc/volatile  (swap              ):   992608 blocks    16964 files
                                  total:   993360 blocks    17025 files
/system/object     (objfs             ):        0 blocks 2147483530 files
                                  total:        0 blocks      117 files
/usr               (/dev/dsk/c0t0d0s6 ):   503774 blocks   299189 files
                                  total:  6650604 blocks   420480 files
/dev/fd            (fd                ):        0 blocks        0 files
                                  total:        0 blocks       31 files
/var/run           (swap              ):   992608 blocks    16964 files
                                  total:   992688 blocks    17025 files
/tmp               (swap              ):   992608 blocks    16964 files
                                  total:   992688 blocks    17025 files
/opt               (/dev/dsk/c0t0d0s5 ):    23914 blocks     6947 files
                                  total:    27404 blocks     7168 files
/export/home       (/dev/dsk/c0t0d0s7 ):    16810 blocks     7160 files
                                  total:    18900 blocks     7168 files</screen>
</example>
</task>
</sect1><sect1 id="sysresdiskuse-3"><title>Checking the Size of Files</title><para>You can check the size of files and sort them by using the <command>ls</command> command. You can find files that exceed a size limit by using the <command>find</command> command. For more information, see the <olink targetdoc="refman" targetptr="ls-1" remap="external"><citerefentry><refentrytitle>ls</refentrytitle><manvolnum>1</manvolnum></citerefentry></olink> and <olink targetdoc="refman" targetptr="find-1" remap="external"><citerefentry><refentrytitle>find</refentrytitle><manvolnum>1</manvolnum></citerefentry></olink> man
pages.</para><note><para>If you run out of space in the <filename>/var</filename> directory,
do not symbolically link the <filename>/var</filename> directory to a directory
on a file system with more disk space.  Doing so, even as a temporary measure,
might cause problems for certain Solaris daemon processes and utilities.</para>
</note><task id="sysresdiskuse-40204"><title>How to Display the Size of Files</title><procedure><step id="sysresdiskuse-step-5"><para>Change to the directory where the files you want to check are
located. </para>
</step><step id="sysresdiskuse-step-6"><para>Display the size of the files.</para><screen>$ <userinput>ls</userinput> [<userinput>-lh</userinput>] [<userinput>-s</userinput>]</screen><variablelist><varlistentry><term><option>l</option></term><listitem><para>Displays a list of files and directories in long format, showing
the sizes in bytes. (See the example that follows.)</para>
</listitem>
</varlistentry><varlistentry><term><option>h</option></term><listitem><para>Scales file sizes and directory sizes into Kbytes, Mbytes,
Gbytes, or Tbytes when the file or directory size is larger than 1024 bytes.
This option also modifies the output displayed by the <option>o</option>, <option>n</option>, <option>@</option>, and <option>g</option> options to display
file or directory sizes in the new format. For more information, see the<olink targetdoc="refman" targetptr="ls-1" remap="external"><citerefentry><refentrytitle>ls</refentrytitle><manvolnum>1</manvolnum></citerefentry></olink> man page.</para>
</listitem>
</varlistentry><varlistentry><term><option>s</option></term><listitem><para>Displays a list of the files and directories, showing the
sizes in blocks.</para>
</listitem>
</varlistentry>
</variablelist>
</step>
</procedure><example id="emjel"><title>Displaying the Size of Files</title><para>The following example shows that the <filename>lastlog</filename> and <filename>messages</filename> files are larger than the other files in the <filename>/var/adm</filename> directory. </para><screen>$ <userinput>cd /var/adm</userinput>
$ <userinput>ls -lh</userinput>
total 148
drwxrwxr-x   5 adm      adm          512 Nov 26 09:39 acct/
-rw-------   1 uucp     bin            0 Nov 26 09:25 aculog
drwxr-xr-x   2 adm      adm          512 Nov 26 09:25 exacct/
-r--r--r--   1 root     other       342K Nov 26 13:56 lastlog
drwxr-xr-x   2 adm      adm          512 Nov 26 09:25 log/
-rw-r--r--   1 root     root         20K Nov 26 13:55 messages
drwxr-xr-x   2 adm      adm          512 Nov 26 09:25 passwd/
drwxrwxr-x   2 adm      sys          512 Nov 26 09:39 sa/
drwxr-xr-x   2 root     sys          512 Nov 26 09:49 sm.bin/
-rw-rw-rw-   1 root     bin            0 Nov 26 09:25 spellhist
drwxr-xr-x   2 root     sys          512 Nov 26 09:25 streams/
-rw-r--r--   1 root     bin         3.3K Nov 26 13:56 utmpx
-rw-r--r--   1 root     root           0 Nov 26 10:17 vold.log
-rw-r--r--   1 adm      adm          19K Nov 26 13:56 wtmpx</screen><para>The following example shows that the <filename>lpsched.1</filename> file
uses two blocks.          </para><screen>$ <userinput>cd /var/lp/logs</userinput>
$ <userinput>ls -s</userinput>
total 2            0 lpsched       2 lpsched.1</screen>
</example>
</task><task id="sysresdiskuse-24569"><title>How to Find Large Files</title><procedure><step id="sysresdiskuse-step-9"><para>Change to the directory that you want to search.  </para>
</step><step id="sysresdiskuse-step-10"><para>Display the size of files in blocks from largest to smallest.
 </para><itemizedlist><listitem><para>If the characters or columns for the files are <emphasis>different</emphasis>, use the following command to sort a list of files by block size,
from largest to smallest.</para><screen>$ <userinput>ls -l | sort +4rn | more</userinput></screen><para>Note that this command sorts files in a list by the character that is
in the fourth field, starting from the left.</para>
</listitem><listitem><para>If the characters or columns for the files are the <emphasis>same</emphasis>, use the following command to sort a list of files by block size,
from largest to smallest.</para><screen>$ <userinput>ls -s | sort -nr | more</userinput></screen><para>Note that this command sorts files in a list, starting with the left
most character.</para>
</listitem>
</itemizedlist>
</step>
</procedure><example id="gbebt"><title>Finding Large Files (Sorting by the Fifth Field's Character)</title><screen>$ <userinput>cd /var/adm</userinput>
$ <userinput>ls -l | sort +4rn | more</userinput>
-r--r--r--   1 root     root     4568368 Oct 17 08:36 lastlog
-rw-r--r--   1 adm      adm       697040 Oct 17 12:30 pacct.9
-rw-r--r--   1 adm      adm       280520 Oct 17 13:05 pacct.2
-rw-r--r--   1 adm      adm       277360 Oct 17 12:55 pacct.4
-rw-r--r--   1 adm      adm       264080 Oct 17 12:45 pacct.6
-rw-r--r--   1 adm      adm       255840 Oct 17 12:40 pacct.7
-rw-r--r--   1 adm      adm       254120 Oct 17 13:10 pacct.1
-rw-r--r--   1 adm      adm       250360 Oct 17 12:25 pacct.10
-rw-r--r--   1 adm      adm       248880 Oct 17 13:00 pacct.3
-rw-r--r--   1 adm      adm       247200 Oct 17 12:35 pacct.8
-rw-r--r--   1 adm      adm       246720 Oct 17 13:15 pacct.0
-rw-r--r--   1 adm      adm       245920 Oct 17 12:50 pacct.5
-rw-r--r--   1 root     root      190229 Oct  5 03:02 messages.1
-rw-r--r--   1 adm      adm       156800 Oct 17 13:17 pacct
-rw-r--r--   1 adm      adm       129084 Oct 17 08:36 wtmpx</screen>
</example><example id="emjem"><title>Finding Large Files (Sorting by the Left Most Character)</title><para>In the following example, the <filename>lastlog</filename> and <filename>messages</filename> files are the largest files in the <filename>/var/adm</filename> directory.
  </para><screen>$ <userinput>cd /var/adm</userinput>
$ <userinput>ls -s | sort -nr | more</userinput>
  48 lastlog
  30 messages
  24 wtmpx
  18 pacct
   8 utmpx
   2 vold.log
   2 sulog
   2 sm.bin/
   2 sa/
   2 passwd/
   2 pacct1
   2 log/
   2 acct/
   0 spellhist
   0 aculog
total 144</screen>
</example>
</task><task id="enmwy"><title>How to Find Files That Exceed a Specified Size Limit</title><procedure remap="single-step"><step><para>To locate and display the names of files that exceed a specified
size, use the <command>find</command> command.</para><screen>$ <userinput>find</userinput> <replaceable>directory</replaceable> <userinput>-size</userinput> <userinput>+</userinput><replaceable>nnn</replaceable> </screen><variablelist><varlistentry><term><replaceable>directory</replaceable></term><listitem><para>Identifies the directory that you want to search.</para>
</listitem>
</varlistentry><varlistentry><term><option>size</option> <command>+</command><replaceable>nnn</replaceable></term><listitem><para>Is a number of 512-byte blocks. Files that exceed this size
are listed.</para>
</listitem>
</varlistentry>
</variablelist>
</step>
</procedure><example id="sysresdiskuse-12"><title>Finding Files That Exceed a Specified Size Limit</title><para>The following example shows how to find files larger than 400
blocks in the current working directory. The <option>print</option> option
displays the output of the <command>find</command> command.</para><screen>$ <userinput>find . -size +400 -print</userinput>
./Howto/howto.doc
./Howto/howto.doc.backup
./Howto/howtotest.doc
./Routine/routineBackupconcepts.doc
./Routine/routineIntro.doc
./Routine/routineTroublefsck.doc
./.record
./Mail/pagination
./Config/configPrintadmin.doc
./Config/configPrintsetup.doc
./Config/configMailappx.doc
./Config/configMailconcepts.doc
./snapshot.rs</screen>
</example>
</task>
</sect1><sect1 id="sysresdiskuse-13"><title>Checking the Size of Directories</title><para>You can display the size of directories by using the <command>du</command> command
and options. Additionally, you can find the amount of disk space used by user
accounts on local UFS file systems by using the <command>quot</command> command.
For more information about these commands, see the <olink targetdoc="refman" targetptr="du-1" remap="external"><citerefentry><refentrytitle>du</refentrytitle><manvolnum>1</manvolnum></citerefentry></olink> and <olink targetdoc="refman" targetptr="quot-1m" remap="external"><citerefentry><refentrytitle>quot</refentrytitle><manvolnum>1M</manvolnum></citerefentry></olink> man
pages.</para><task id="enmwv"><title>How to Display the Size of Directories, Subdirectories,
and Files</title><procedure remap="single-step"><step><para>Display the size of one or more directories, subdirectories, and
files by using the <command>du</command> command. Sizes are displayed in 512-byte
blocks.</para><screen>$ <userinput>du</userinput> [<userinput>-as</userinput>] [<replaceable>directory ...</replaceable>]</screen><variablelist><varlistentry><term><command>du</command></term><listitem><para>Displays the size of each directory that you specify, including
each subdirectory beneath it.</para>
</listitem>
</varlistentry><varlistentry><term><option>a</option></term><listitem><para>Displays the size of each file and subdirectory, and the total
number of blocks that are contained in the specified directory.</para>
</listitem>
</varlistentry><varlistentry><term><option>s</option></term><listitem><para>Displays the total number of blocks that are contained in
the specified directory.</para>
</listitem>
</varlistentry><varlistentry><term><option>h</option></term><listitem><para>Displays the size of each directory in 1024&ndash;byte blocks.</para>
</listitem>
</varlistentry><varlistentry><term><option>H</option></term><listitem><para>Displays the size of each directory in 1000&ndash;byte blocks.</para>
</listitem>
</varlistentry><varlistentry><term>[<replaceable>directory ...</replaceable>]</term><listitem><para>Identifies one or more directories that you want to check.
Separate multiple directories in the command-line syntax with spaces.</para>
</listitem>
</varlistentry>
</variablelist>
</step>
</procedure><example id="sysresdiskuse-14"><title>Displaying the Size of Directories, Subdirectories, and Files</title><para>The following example shows the sizes of two directories.   </para><screen>$ <userinput>du -s /var/adm /var/spool/lp</userinput>
130     /var/adm
40      /var/spool/lp</screen><para>The following example shows the sizes of two directories and includes
the sizes of all the subdirectories and files that are contained within each
directory. The total number of blocks that are contained in each directory
is also displayed.</para><screen>$ <userinput>du /var/adm /var/spool/lp</userinput>
2       /var/adm/exacct
2       /var/adm/log
2       /var/adm/streams
2       /var/adm/acct/fiscal
2       /var/adm/acct/nite
2       /var/adm/acct/sum
8       /var/adm/acct
2       /var/adm/sa
2       /var/adm/sm.bin
258     /var/adm
4       /var/spool/lp/admins
2       /var/spool/lp/requests/printing.Eng.Sun.COM
4       /var/spool/lp/requests
4       /var/spool/lp/system
2       /var/spool/lp/fifos
24      /var/spool/lp</screen><para>The following example shows directory sizes in 1024&ndash;byte blocks.</para><screen>$ <userinput>du -h /usr/share/audio</userinput>
 796K   /usr/share/audio/samples/au
 797K   /usr/share/audio/samples
 798K   /usr/share/audio</screen>
</example>
</task><task id="sysresdiskuse-87953"><title>How to Display the User Ownership of
Local UFS File Systems</title><procedure>&rolestep.sgm;<step id="sysresdiskuse-step-17"><para>Display users, directories, or file
systems, and the number of 1024-byte blocks used.</para><screen># <userinput>quot</userinput> [<userinput>-a</userinput>] [<replaceable>filesystem ...</replaceable>]</screen><variablelist><varlistentry><term><option>a</option></term><listitem><para>Lists all users of each mounted UFS file system and the number
of 1024-byte blocks used.</para>
</listitem>
</varlistentry><varlistentry><term><replaceable>filesystem</replaceable></term><listitem><para>Identifies a UFS file system. Users and the number of blocks
used are displayed for that file system.</para>
</listitem>
</varlistentry>
</variablelist><note><para>The <command>quot</command> command works only on local UFS file
systems.</para>
</note>
</step>
</procedure><example id="emjen"><title>Displaying the User Ownership of Local UFS File Systems</title><para>In the following example, users of the root (<filename>/</filename>)
file system are displayed. In the subsequent example, users of all mounted
UFS file systems are displayed.</para><screen># <userinput>quot /</userinput>
/dev/rdsk/c0t0d0s0:
43340   root    
 3142   rimmer   
   47   uucp    
   35   lp      
   30   adm     
    4   bin     
    4   daemon  </screen><screen># <userinput>quot -a</userinput>
/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</screen>
</example>
</task>
</sect1><sect1 id="sysresdiskuse-19"><title>Finding and Removing Old or Inactive Files</title><para>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 by using the <command>ls</command> or <command>find</command> commands.
For more information, see the <olink targetdoc="refman" targetptr="ls-1" remap="external"><citerefentry><refentrytitle>ls</refentrytitle><manvolnum>1</manvolnum></citerefentry></olink> and <olink targetdoc="refman" targetptr="find-1" remap="external"><citerefentry><refentrytitle>find</refentrytitle><manvolnum>1</manvolnum></citerefentry></olink> man pages.</para><para>Other ways to conserve disk space include emptying temporary directories
such as the directories located in <filename>/var/tmp</filename> or <filename>/var/spool</filename>, and deleting <filename>core</filename> and crash dump files.
For more information about crash dump files, refer to <olink targetptr="tscrashdumps-40145" remap="internal">Chapter&nbsp;17, Managing System Crash Information (Tasks)</olink>.</para><task id="enmxb"><title>How to List the Newest Files</title><procedure remap="single-step"><step><para>List files, displaying the most recently created or changed files
first, by using the <command>ls</command> <option>t</option> command.      </para><screen>$ <userinput>ls -t</userinput> [<replaceable>directory</replaceable>]</screen><variablelist><varlistentry><term><option>t</option></term><listitem><para>Sorts files by latest time stamp first.</para>
</listitem>
</varlistentry><varlistentry><term><replaceable>directory</replaceable></term><listitem><para>Identifies the directory that you want to search.</para>
</listitem>
</varlistentry>
</variablelist>
</step>
</procedure><example id="sysresdiskuse-21"><title>Listing the Newest Files</title><para>The following example shows how to use the <command>ls -tl</command> command
to locate the most recently created or changed files within the <filename>/var/adm</filename> directory. The <filename>sulog</filename> file was created or
edited most recently.  </para><screen>$ <userinput>ls -tl /var/adm</userinput>
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</screen>
</example>
</task><task id="sysresdiskuse-10372"><title>How to Find and Remove Old or Inactive
Files</title><procedure>&rolestep.sgm;<step id="sysresdiskuse-step-24"><para>Find files that have not been accessed for a specified number
of days and list them in a file.</para><screen># <userinput>find</userinput> <replaceable>directory</replaceable> <userinput>-type f</userinput>[<userinput>-atime +</userinput><replaceable>nnn</replaceable>] [<userinput>-mtime +</userinput><replaceable>nnn</replaceable>] <userinput>-print ></userinput> <replaceable>filename</replaceable> &amp;</screen><variablelist><varlistentry><term><replaceable>directory</replaceable></term><listitem><para>Identifies the directory you want to search. Directories below
this directory are also searched.</para>
</listitem>
</varlistentry><varlistentry><term><option>atime +</option><replaceable>nnn</replaceable></term><listitem><para>Finds files that have not been accessed within the number
of days (nnn) that you specify.</para>
</listitem>
</varlistentry><varlistentry><term><option>mtime +</option><replaceable>nnn</replaceable></term><listitem><para>Finds files that have not been modified within the number
of days (nnn) that you specify.</para>
</listitem>
</varlistentry><varlistentry><term><replaceable>filename</replaceable></term><listitem><para>Identifies the file that contains the list of inactive files.</para>
</listitem>
</varlistentry>
</variablelist>
</step><step id="sysresdiskuse-step-25"><para>Remove the inactive files found listed in the previous step.</para><screen># <userinput>rm `cat</userinput> <replaceable>filename</replaceable><userinput>`</userinput></screen><para>where <replaceable>filename</replaceable> identifies the file that was
created in the previous step. This file contains the list of inactive files.</para>
</step>
</procedure><example id="emjeo"><title>Finding and Removing Old or Inactive Files</title><para>The following example shows files in the <filename>/var/adm</filename> directory
and the subdirectories that have not been accessed in the last 60 days. The <filename>/var/tmp/deadfiles</filename> file contains the list of inactive files. The <command>rm</command> command removes these inactive files. </para><screen># <userinput>find /var/adm -type f -atime +60 -print > /var/tmp/deadfiles &amp;</userinput>
# <userinput>more /var/tmp/deadfiles</userinput>
/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
# <userinput>rm `cat /var/tmp/deadfiles`</userinput>
#</screen>
</example>
</task><task id="sysresdiskuse-83518"><title>How to Clear Out Temporary Directories</title><procedure>&rolestep.sgm;<step id="sysresdiskuse-step-29"><para>Change to the directory that you want
to clean out.</para><screen># <userinput>cd</userinput> <replaceable>directory</replaceable></screen><caution><para>Ensure that you are in the correct directory before completing
Step 3. Step 3 deletes all files in the current directory.</para>
</caution>
</step><step id="sysresdiskuse-step-30"><para>Delete the files and subdirectories
in the current directory.</para><screen># <userinput>rm -r *</userinput></screen>
</step><step id="sysresdiskuse-step-31"><para>Change to other directories that contain
unnecessary, temporary or obsolete subdirectories and files. Delete these
subdirectories and files by repeating Step 3.</para>
</step>
</procedure><example id="emjeq"><title>Clearing Out Temporary Directories</title><para>The following example shows how to clear out the <filename>mywork</filename> directory,
and how to verify that all files and subdirectories were removed.</para><screen># <userinput>cd mywork</userinput>
# <userinput>ls</userinput>
filea.000
fileb.000
filec.001
# <userinput>rm -r *</userinput>
# <userinput>ls</userinput>
#</screen>
</example>
</task><task id="sysresdiskuse-85712"><title>How to Find and Delete <filename>core</filename> Files</title><procedure>&rolestep.sgm;<step id="sysresdiskuse-step-36"><para>Change to the directory where you want
to search for <filename>core</filename> files.</para>
</step><step id="sysresdiskuse-step-37"><para>Find and remove any <filename>core</filename> files in this directory
and its subdirectories.</para><screen># <userinput>find . -name core -exec rm {} \;</userinput></screen>
</step>
</procedure><example id="emjes"><title>Finding and Deleting <command>core</command> Files</title><para>The following example shows how to find and remove <filename>core</filename> files
from the <filename>jones</filename> user account by using the <command>find</command> command. </para><screen># <userinput>cd /home/jones</userinput>
# <userinput>find . -name core -exec rm {} \;</userinput></screen>
</example>
</task><task id="sysresdiskuse-45392"><title>How to Delete Crash Dump Files</title><tasksummary><para>Crash dump files can be very large. If you have enabled your system
to store these files, do not retain them for longer than necessary.</para>
</tasksummary><procedure>&rolestep.sgm;<step id="sysresdiskuse-step-41"><para>Change to the directory where crash
dump files are stored. </para><screen># <userinput>cd /var/crash/</userinput><replaceable>system</replaceable></screen><para>where <replaceable>system</replaceable> identifies a system that created
the crash dump files.</para><caution><para>Ensure you are in the correct directory before completing Step
3. Step 3 deletes all files in the current directory.</para>
</caution>
</step><step id="sysresdiskuse-step-42"><para>Remove the crash dump files. </para><screen># <userinput>rm *</userinput></screen>
</step><step id="sysresdiskuse-step-45"><para>Verify that the crash dump files were
removed. </para><screen># <userinput>ls</userinput></screen>
</step>
</procedure><example id="emjev"><title>Deleting Crash Dump Files</title><para>The following example shows how to remove crash dump files from
the system <filename>venus</filename>, and how to verify that the crash dump
files were removed. </para><screen># <userinput>cd /var/crash/venus</userinput>
# <userinput>rm *</userinput>
# <userinput>ls</userinput></screen>
</example>
</task>
</sect1>
</chapter>