If your Linux server or desktop is running low on disk space, chances are that a few large files or directories are taking up most of the storage. Instead of searching manually, you can use built-in Linux commands like du, find, and sort to quickly locate the largest files and free up space.

This guide will walk you through different methods, using the terminal and graphical tools, to identify the biggest files and directories on your Linux system.

Why Do You Need to Find Large Files in Linux?

  • Troubleshooting disk space issues: If your server stops working due to “No space left on device” errors, you need to quickly identify space hogs.

  • System cleanup: Large log files, backups, or temporary files can accumulate unnoticed.

  • Better storage management: Knowing what’s taking space helps optimize your SSD/HDD usage.

Method 1: Using du Command

The du (disk usage) command is one of the most common ways to check file sizes in Linux.

Example: Find the Top 20 Largest Files in a Directory

du -ah /path/to/directory | sort -rh | head -n 20

  • du -ah → Displays the size of each file and directory.

  • sort -rh → Sorts results by size in human-readable format (MB, GB).

  • head -n 20 → Shows only the top 20 largest items.

If you want to scan your entire system:

sudo du -ah / 2>/dev/null | sort -rh | head -n 20

 

                

Method 2: Using the find Command

The find command is powerful when you want to list only files (excluding directories).

Example: Find the 10 Largest Files

find /home -type f -printf "%s %p\n" | sort -nr | head -10

  • -type f → Finds only files.
  • -printf "%s %p\n" → Prints file size (in bytes) and file path.
  • sort -nr → Sorts numerically in descending order.
  • head -10 → Shows the top 10 largest files.

To scan the whole system:

sudo find / -type f -printf "%s %p\n" 2>/dev/null | sort -nr | head -10

                

Method 3: Create a Shortcut with an Alias

If you frequently need to check disk space, set up a bash alias for quick access:

alias ducks='du -cks * | sort -rn | head'

Now, just type:

ducks

It will instantly list the largest files and directories in the current folder.

 

                       

 

Method 4: Use ncdu for Interactive Disk Usage

For an easier, interactive approach, install ncdu:

Install ncdu

sudo apt install ncdu    # Debian/Ubuntu

sudo dnf install ncdu    # Fedora/RHEL

Run ncdu

ncdu /

This will open a text-based interface where you can navigate and identify space-hungry files.

 

                      

 

Method 5: GUI Tools (For Desktop Users)

If you prefer graphical tools over the terminal, try:

Baobab (Disk Usage Analyzer – GNOME)

baobab

You’ll get a tree view and pie chart of your disk usage.

QDirStat

sudo apt install qdirstat   # Debian/Ubuntu

sudo dnf install qdirstat   # Fedora

qdirstat

It gives a colorful, interactive view of your disk, making it easier to spot large files.

What to Do After Finding Large Files?

Once you’ve identified the biggest files, you can:

Delete unnecessary files:

rm -i /path/to/file

Remove entire directories:

rm -rf /path/to/folder

Move files to external storage:

mv /path/to/large/file /mnt/usb/


Warning
: Be careful while deleting system files (like kernel files, configs, or libraries). Removing critical files may break your Linux installation.

Conclusion

Finding the largest files in Linux is simple once you know the right commands. Whether you prefer the du + sort method, the find command, or graphical tools like QDirStat, you can easily identify what’s eating up your disk space and take action.

With these methods, managing disk space on your Linux system becomes much easier!

If you need professional assistance with Linux server management, troubleshooting, or disk cleanup, our team is here to help. You can hire one of our system administrators for dedicated support.

 

 

Was this answer helpful? 0 Users Found This Useful (0 Votes)