CloudsArk
Commands Linux

du Find Large Directories in Linux

Learn advanced and troubleshooting-focused du usage for practical Linux administration.

du Find Large Directories in Linux

Introduction

Advanced du usage helps when the basic form is not enough. This article focuses on realistic command patterns that are useful during administration and troubleshooting.

When You Need Advanced Usage

Use du when you need to find which directories or files are consuming space inside a filesystem. It complements df during disk-full troubleshooting. Advanced usage is most useful when you need to narrow scope, work on multiple targets, or diagnose why the first command did not answer the question.

Practical Examples

Inspect first:

df -h /var

Run a focused command:

du -ah /var/log | sort -h

Use a real-world pattern:

sudo du -xhd1 / | sort -h

Troubleshooting

If du does not give the expected result, verify the target first with df -h /var. Then check permissions, paths, service state, network reachability, package repositories, or process state depending on what the command manages.

Example output:

1.4G    /var/log

Common Mistakes

  • Running du across huge trees without limiting depth.
  • Comparing du and df without considering deleted open files.
  • Forgetting -x when you want to stay on one filesystem.

Safety Notes

Use a preview, backup, dry run, read-only command, or smaller test target before applying broad, recursive, destructive, or remote operations.

Summary

Advanced du usage should still be controlled. Build the command step by step and verify the result separately.