Find where disk space is being used on Linux from command line

  • 3005720
  • 12-May-2006
  • 30-Apr-2012


Novell Open Enterprise Server (Linux based)
Novell SUSE Linux Enterprise Server 10
Novell SUSE Linux Desktop 10
Novell SUSE Linux Enterprise Server 9
Novell SUSE Linux Enterprise Server 8


Root partition is full.
Need to find where disk space is being used.
Server hangs during boot process.


  1. If a partition is full, the first step will be to determine which partition is full.  If the partitions are not mounted, you will need to mount the partition(s) first.  If the partition(s) are mounted, type 'df -h'.  This will show the free and used space on the mounted partitions, from which you can determine the partition to examine.  The 'df -h' screen also shows where the partition is mounted.
  2. If you know a mount point that is full, change to that directory.  If not, change to the root directory 'cd /'.
  3. You can use the command 'du -h --max-depth=1' to get a summary of the subdirectories and how much space they are using.  The last number is the total space used by the current directory and the subdirectories.  You may have to use 'du -h --max-depth=1 | less' if there are more directories than fit on the screen.  The pipe symbol with 'less' allows you to scroll through the output.  The 'q' key quits the scrolling.
  4. If you identify a directory using more space than you expect, you can change to that directory, and repeat step 3.  Do this until you reach a directory that doesn't appear to have any suspicious sub folders.
  5. You can view the files (with their size) in the current directory with 'ls -lhrS'.  Again, you may need 'ls -lhrS | less' if there are many files.  From this you can identify large files.
  6. Once you've identified where your disk space is being used, you will need to determine if it is safe to remove the file, or move the file to another location. 

Additional Information

To mount a partition, you need to know the device name of the partition.  For example, the second partition on a SCSI disk might be /dev/sda2.  You also need a mount point.  With SUSE Linux and most other Linux distributions, the /mnt/ is set aside as an empty mount point.  To mount the partition, type:
'mount /dev/sda2 /mnt/'