How to use the SSH du command

The SSH du (disk usage) command reports how much space files and directories use on your Linux server. In particular, it’s useful for finding which folders consume the most space – helpful when you have many uploads, daily backups, or multiple sites on shared hosting. Furthermore, du is fast and works on any path, making it essential for monitoring disk usage on a VPS, dedicated server, or hosting account via SSH.

Basic disk usage

To see disk usage for the current directory and all subdirectories using SSH du command:

du

By default, output is in kilobytes. To see sizes in human-readable format (KB, MB, GB), use -h:

du -h

Example – check your home directory: du -h ~ or du -h ~/public_html for your website files.

Show all files

To see disk usage for every file (not just directories), use -a:

du -ah

This lists each file with its size. Useful for finding large individual files. Combine with a path: du -ah ~/public_html.

Summary per directory

To see a summary for each subdirectory in the current folder (without drilling down):

du -sh ./*

The -s gives a single total per item; -h makes it human-readable. This quickly shows which subdirectories use the most space – for example, public_html, logs, or backups.

Limit depth

To show only the first level of subdirectories:

du -h --max-depth=1

Or on BSD/macOS: du -h -d 1. Use --max-depth=2 to include one more level. Helps avoid long output when scanning large trees.

Common use cases

Typical uses for SSH du command on a Linux hosting account:

  • Finding which WordPress site or folder uses the most space
  • Checking backup or upload directory sizes before cleanup
  • Identifying large log files or cache directories
  • Monitoring disk usage when approaching plan limits

To see total space and free space for the whole disk, use df -h. For listing files by size, combine du with sort: du -sh ./* | sort -hr.

Need more help?

Explore more SSH and hosting guides in our knowledgebase. JetHost web hosting includes SSH access for managing your server and monitoring disk usage.