System Administration Guide: Advanced Administration

How to Find Large Files

  1. Change to the directory that you want to search.

  2. Display the size of files in blocks from largest to smallest.


    $ ls -s | sort -nr | more
    

    sort -nr

    Sorts the list of files by block size from largest to smallest. 

Example—Finding Large Files

In the following example, the lastlog and messages files are the largest files in the /var/adm directory.


$ cd /var/adm
$ ls -s | sort -nr | more
  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