Running out of disk space on your Linux server? Whether you manage a cloud VPS, dedicated server, or enterprise infrastructure, knowing how to find the largest files and directories on a Linux / UNIX / BSD system is a critical system administration skill. In this guide, you will learn how to quickly identify the top 10 largest files and directories using simple command-line tools available on almost every Unix-like operating system.

Why Finding Large Files Matters

Disk space issues can cause serious problems including application crashes, failed backups, database corruption, and system instability. By identifying large files and folders early, you can:

  • Free up disk space on Linux servers
  • Troubleshoot high disk usage
  • Optimize VPS storage performance
  • Prevent “No space left on device” errors
  • Improve overall server reliability

The methods below work on most Linux distributions, as well as UNIX and BSD systems.

Method 1: Find the Top 10 Largest Directories in Linux

The du (disk usage) command is the most common way to analyze directory sizes.

du -h --max-depth=1 / | sort -hr | head -n 10 

Explanation

  • du -h → Shows disk usage in human-readable format (MB, GB)
  • --max-depth=1 → Limits output to the current directory level
  • sort -hr → Sorts results by size, largest first
  • head -n 10 → Displays only the top 10 results

This command is ideal when you need to find the largest directories on a Linux server quickly.

If you want to scan a specific folder (for example, /var):

du -h --max-depth=1 /var | sort -hr | head -n 10 

Method 2: Find the Top 10 Largest Files on Linux

To locate the largest individual files on your system, use the find command combined with du and sort.

find / -type f -exec du -h {} + 2>/dev/null | sort -hr | head -n 10 

Explanation

  • find / -type f → Searches for all regular files
  • -exec du -h {} + → Calculates file sizes
  • 2>/dev/null → Suppresses permission errors
  • sort -hr → Sorts by largest size
  • head -n 10 → Shows the 10 largest files

This is extremely useful when troubleshooting unexpected disk growth, large log files, or oversized backup archives.

Method 3: Faster Alternative Using ls for Current Directory

If you only want to check large files in your current directory:

ls -lhS | head -n 10 

This command sorts files by size (largest first) and displays the top entries.

Method 4: Find Large Files Over a Specific Size

If you are searching for files larger than 1GB, use:

find / -type f -size +1G 2>/dev/null 

This approach is helpful when performing Linux disk cleanup or investigating storage usage spikes.

How To Safely Clean Up Large Files

Before deleting anything, always verify what the file is used for. Some common large file locations include:

  • /var/log – Log files
  • /var/lib/mysql – Database storage
  • /home – User files
  • /tmp – Temporary files
  • Backup archives (.tar, .gz, .zip)

Instead of deleting immediately, consider:

  • Rotating logs properly
  • Compressing old files
  • Moving backups to external storage
  • Expanding disk space if necessary

Works on Linux, UNIX, and BSD

The commands shown in this tutorial work on most major systems including Ubuntu, Debian, AlmaLinux, Rocky Linux, CentOS, FreeBSD, and other UNIX-like operating systems. Because they rely on standard utilities such as du, find, sort, and head, they are widely portable.

Final Thoughts

Finding the top 10 largest files and directories on a Linux / UNIX / BSD system is simple once you know the right commands. Using tools like du and find, you can quickly diagnose disk usage issues, prevent storage outages, and maintain optimal server performance.

If you regularly manage Linux servers or VPS environments, adding these commands to your troubleshooting toolkit will save you time and prevent downtime. Disk space management is one of the most important skills for system administrators, DevOps engineers, and hosting professionals.

Now you know exactly how to find the largest files and directories in Linux — and how to keep your server running efficiently.

Byla tato odpověď nápomocná? 255 Uživatelům pomohlo (501 Hlasů)