Home / Blog / du -ah Command in Linux: Check Disk Usage Easily

du -ah Command in Linux: Check Disk Usage Easily

The Linux du -ah command displays disk usage for files and directories in a human-readable format. Learn how to use it to identify large files and monitor server storage.

du -ah Command in Linux: Check Disk Usage Easily

du -ah Command in Linux

When managing a Linux server, knowing which files and directories are consuming storage is important. The du -ah command provides a simple way to view disk usage for both files and directories in a human-readable format.

The current Solace Infotech page describes du -ah as a way to find large files and monitor disk space.

What Does du -ah Mean?

The command is:

 
du -ah
 

Here:

  • du means disk usage.
  • -a displays usage for files as well as directories.
  • -h displays sizes in a human-readable format such as KB, MB, and GB.

For example:

 
4.0K    ./test.txt
20M     ./images
150M    ./backup
 

This makes it easier to understand where storage is being used.

Check a Specific Directory

You can run the command against a particular location:

 
du -ah /var/log
 

This can help identify large log files or directories consuming excessive disk space.

Find Large Files

Combining du with sort can make it easier to find the largest items:

 
du -ah /var | sort -h
 

The result can help you quickly identify which files or directories require attention.

du -ah vs df -h

These commands are often used together.

df -h shows overall filesystem space.

du -ah shows where that space is being consumed.

For example, use df -h when you want to know whether a disk is nearly full, and du -ah when you want to investigate what is using the storage.

Best Practices

Use du -ah when troubleshooting disk-space problems, but avoid running it on very large directory trees without a specific purpose because the output can become extensive.

Before deleting large files, always verify that they are unnecessary and not required by the operating system or an application.

Conclusion

The du -ah command is a useful Linux tool for understanding disk usage at both the file and directory level. Its combination of detailed output and human-readable sizes makes it especially helpful for server monitoring and troubleshooting.

For practical Linux administration, combining df -h with du -ah provides a useful way to understand both how much storage is available and where it is being used.

Contact Us

1119 W Duarte Rd, Arcadia, CA 91007

Solace Infotech Pvt. Ltd, Supreme HQ,
          HQ3C+9F2, Yash Orchid Society,
          Baner, Pune, Maharashtra 411021

4th Floor, Samraat Nucleus,
           Mumbai Naka, Nashik - 422001