4 Ways to Find Large Files on Linux and Free Up Disk Space

Running out of disk space is a frustratingly common occurrence for Linux users. As your media libraries swell with high resolution photos, videos, and music, and your work documents pile up, available capacity can vanish before you know it.Suddenly you’re unable to install new software or download that hot new game on Steam.

As Linux servers accumulate data from more applications over time, available disk space gets consumed. Without carefully monitoring utilization and optimizing large space-hogging files as part of regular Linux File management, critical systems can experience performance slowdowns or even outages once capacity is fully exhausted.

According to statistics from Statista, the average hard disk drive capacity shipped worldwide has ballooned from around 140GB in 2004 to 10TB in 2021 – over a 70x increase! With all that space, you’d think running out of room would be a thing of the past.

However, various surveys have found that the average disk utilization rate across consumer devices is only around 37%. All that free space taunts us while Windows and Linux systems grind to a halt, prevented from updating due to a lack of a few gigabytes.

The solution lies in periodically cleaning up your Linux system by locating and removing the space hogs. By deleting or archiving large, unused files, you can reclaim capacity and dramatically speed up your system’s performance. No need to rush out and buy a larger disk drive – the extra room is already there hiding in plain sight.

There are important benefits for administrators to proactively locate and address the biggest files in Ubuntu and similar distributions:

  • Avoid disruptive system failures or corruption from 100% disk usage.
  • Identify storage trends early to plan upgrades before hitting limits.
  • Determine what is unnecessarily consuming excess space for clean up.
  • Reclaim capacity by compressing, archiving or deleting large unnecessary files.
  • Prevent essential data loss resulting from insufficient available storage space.

By leveraging tools to regularly find, review and optimize the largest files, administrators can maintain a clear picture of disk usage. Taking prompt action on oversized files, older logs and temporary data ensures Linux systems do not run out of storage space.

Within this article, we will delve into several distinct approaches to find large files on linux / Ubuntu.

Read: How to copy a file to multiple directories in Linux

Why You Should Find and Remove Large Files

First let’s look at why it’s so important to periodically search your Linux system for large, unused files that can be safely removed.

As we saw earlier, disk drive capacity has rapidly grown over the years, with 10TB drives now common. However, our data storage needs have grown even faster! High resolution photos and videos take up more and more space, while music collections continue to expand.

According to a 2022 Statista survey, the average number of digital photos taken annually per person reached over 1,000! All those Instagram perfect shots devour GBs over time.

At the same time, programs and media files are ballooning in size. For example, the Windows 10 21H2 release requires a minimum of 64GB of storage, while popular games like Call of Duty: Modern Warfare take up over 230GB.

With all this upward pressure on storage space, it’s no wonder our disks fill up. Luckily there’s already extra room available if you can find and clean out the largest files collecting dust.

Here are some key benefits to optimizing disk usage by locating and removing large unnecessary files:

  • Free up space for new software and updates – By deleting unused files, you open up capacity for new programs, games, media files and operating system updates which often require many GBs.
  • Speed up overall system performance – Accessing files on a disk that’s nearly full causes slowdowns and lag as the head scrambles around looking for free blocks. Removing large files results in faster access times.
  • Organize your filesystem – See what’s using space and where it resides so you can properly organize your files and folders.
  • Remove duplicate, temporary and corrupted files – Large files often include duplicate downloads, old temporary files that pile up, and corrupted data. Cleaning them up fixes issues…

Find command

Initiating its search from the designated directory, the ‘find’ command traverses all accessible subdirectories. It’s possible to indicate multiple starting directories for the search. The forthcoming command aids in the identification of large files in Linux / Ubuntu.

To start, launch your terminal and input the following command:


Read: How to copy a file to multiple directories in Linux

Next execute the provided commands below to display the largest files while excluding directories. Enter the following command on your computer :

sudo find / -type f -printf “%s\t%p\n” | sort -n | tail -1

$ find $HOME -type f -printf ‘%s %p\n’ | sort -nr | head -10

Read: How to use symbolic links on Linux

The Linux ‘find’ command supports useful options to search for files exceeding specified size thresholds. For example, to locate extremely large files over 100MiB in size use the command below: (this is not 100MB, see here):

find / -size +100M -ls

Find largest files Linux

Read: How to find the size of a file or directory on Linux using du and ncdu commands

The Linux ‘find’ command supports specifying both minimum and maximum file size thresholds when searching directories. This allows administrators to precisely target files within a certain size range for optimized analysis.

For example, to find files between 100MiB and 200MiB:

find / -size +100M -size -200M -ls

The Linux ‘find’ command can be combined with ‘ls’, ‘sort’ and ‘tail’ to isolate the top 5 biggest files within a directory for admin review.

For example:

find /var/log -type f -exec ls -s {} \; | sort -n | tail -n 5

This first uses ‘find’ to locate all regular files in /var/log. The ‘-exec ls -s’ parameter prints the size of each file. Output is piped to ‘sort -n’ for numerical sorting, and ‘tail -n 5’ returns the last 5 entries (the 5 largest files).

In concluding remarks concerning the ‘find’ command, it’s noteworthy that the command’s versatility extends to scenarios beyond simple file searches. For example, it can be employed to locate files that are within a certain age range, such as those created less than or equal to ‘n’ days ago (-ctime -n). Additionally, the ‘find’ command facilitates filtering files based on their ownership, enabling users to identify files attributed to specific users (e.g., -user mrlinux).

Read: Removing duplicates from content: 6 effective tools in 2022

du Command

The du command provides a powerful tool for analyzing file space usage in Linux. This versatile command lets administrators easily identify and retrieve files and directories consuming substantial storage capacity.

Running du on a disk or directory outputs the total allocated space for each subfolder and file in human-readable format.

First , invoke the command below which will enable you to switch to root :


And then execute :

sudo du -a /home | sort -n -r | head -n 20

sudo du with sort and head

du Linux command

Read: How to hide folders and show hidden files in Ubuntu

The du command performs a file size assessment within the home directory. This assessment data is then sorted using the sort command. Finally, the head argument constrains the output to only the top 20 largest files.

How do I find 10 largest directories in Linux?

To display the top 10 largest directories in the current working directory on Linux, the following command can be used:

sudo du -a | sort -n -r | head -n 10

Read: How to display Graphics card information on Ubuntu 22.04

The Linux command provided above shows the top 10 largest directories in the current working directory. Here is an explanation of each part:

  • du – Display disk usage statistics
  • du -a – Show disk usage for all files and directories recursively
  • | – Pipe symbol, takes output of one command and provides as input to next
  • sort – Sort input text
  • sort -n – Sort numerically rather than alphabetically
  • sort -r – Reverse sort order, largest to smallest
  • | – Pipe output of sort to next command
  • head – Output first lines of input
  • head -n 10 – Show first 10 lines only

Read: How to fix: ‘cannot open shared object file : No such file or directory’ on Ubuntu

If you intend to utilize measurements in KB or GB, you can achieve this by executing the command :

du -hs * | sort -rh | head -n 10

The du command shown earlier displays the top 10 largest directories in the current folder. These may contain expendable files or subdirectories that can be deleted to free up disk space.

Review the output and determine if any directories are good candidates for removal. Things like temporary files, old logs, build artifacts, and unused downloads can often be safely deleted.

To take it a step further and show disk usage including subdirectory sizes, use:

du -Sh | sort -rh | head -n 10

Below is a breakdown of the above command’s components:

  • ‘du’: This is the du command itself.
  • ‘-h’: Sizes are displayed in a human-readable format (e.g., 3MB).
  • ‘-S’: Subdirectory sizes are excluded.
  • ‘Sort’: Sorts the text file input stream (from the pipe entry).
  • ‘-r’: This flag reverses the result of comparisons.
  • ‘-h’: Enables human-readable number comparisons (e.g., 2K, 1G).
  • ‘head’: Prepares the provided list for standard output.
  • ‘-n’: Specifies the number of lines to return (in this case, limited to the first 10 lines).”

To exclude error message of type “permission denied” for instance , just add the parameter : 2>/dev/null like for example:

du -a /* 2>/dev/null | sort -nr | head -n 50

To identify files within the GB size range, you can effectively employ a combination of the ‘du’ and ‘grep’ commands :

du -h -a /dir | grep “[0-9]G\b”

Read: What you need to do to secure Ubuntu

ls Command

In addition to analyzing disk usage by directories, it can be useful to identify large individual files on a Linux system. This helps pinpoint specific files to inspect and potentially remove to free up space.

The ls command can display file details including size. To find the 5 biggest files in the /bin directory, run:

ls -lSh /bin | head -5

Breaking this down:

  • ls -lSh lists files in long format with human readable sizes
  • /bin specifies the directory to list
  • | head -5 pipes the output to head to show the first 5 results

This will display the 5 largest files in /bin sorted by size. The largest files will be at the top.

Review the output to identify large files that may no longer be needed. Deleting unneeded files directly frees up space.

Read : How to keep Ubuntu clean

Using disk usage analyzer ( Baobab )

The Disk Usage Analyzer, formerly known as Baobab, serves as a valuable tool within the GNOME desktop environment for assessing disk usage. Operating similarly to a file explorer, it boasts a graphical interface that presents the disk drive’s contents in an easily comprehensible manner. This tool empowers you to scan specific sections of the filesystem, be it an individual folder, the complete filesystem, or even remote directories.

To install Baobab, simply execute the following command:

sudo apt install baobab

And then invoke baobab to execute it. The window below will pop up:

How to list all directories in Linux with size?

The folder visualization tool allows you to fully explore your file system hierarchy. View key details for each folder including size, modification date, and contents in an easy-to-read interactive map. The chart reflects the folder structure, enabling you to identify large folders and optimize storage. Gain visibility into your entire file system to intelligently organize and free up space.

Read: How to install and uninstall applications in Ubuntu ? A Beginner’s guide

Safely Cleaning Up Space on Linux

After locating the largest files wasting space, you can reclaim capacity by safely removing or archiving them. Here are some tips:

  • Preview files before deleting – Carefully verify files are indeed not needed to avoid losing important data
  • Move to external storage – Offload media files and other large data to external drives
  • Compress with archives – Tar, zip, and rar files to free space while retaining data
  • Use secure deletion – Shred files to permanently delete sensitive data

For example, by archiving old user log files you can compress 1GB of data down to 100MB while keeping the logs available if needed.

When deleting files, use shred rather than standard rm whenever possible. Shred overwrites data multiple times before removing a file, preventing recovery:

shred logfile.log

Some common Linux files and directories that are safe targets for cleaning up space:

  • Cached package files in /var/cache/pacman
  • Old system logs in /var/log
  • Temp folders like /tmp or /var/tmp
  • Useless system crash reports in /var/crash

Be cautious of files in key folders like /etc, /bin, /usr, and /opt to avoid deleting important system files.

Read: How to check memory usage on Ubuntu 22.04


Running low on free space doesn’t mean you need to buy a larger disk. By thoroughly analyzing disk usage and locating large unused files, you can recover gigabytes of capacity and speed up Linux.

Use powerful but simple command line tools like du, find,ls, Disk Usage Analyzer (Baobab), and ls to pinpoint the files and folders consuming space. Then carefully delete, move, or archive them to clean up your system.

Regularly applying these Linux disk space tips will keep your filesystem lean and optimized. Follow the approaches outlined to consistently find disk hogs and reclaim capacity. You’ll prevent low disk errors, speed up access, and make space for new software and data.

So don’t let your Linux system grind to a halt from lack of space. Start actively managing disk usage today and keep your system running smoothly for years to come.

If you like the content, we would appreciate your support by buying us a coffee. Thank you so much for your visit and support.


Nikolaus Oosterhof

Nikolaus holds a degree in software development and has a strong passion for all things tech-related, especially gadgets with screens. Though he is nostalgic for older phone models, he's a retired gamer and continues to enjoy programming in open-source environments. Additionally, Nikolaus enjoys writing about Linux, macOS and Windows and has experience designing web pages.

Leave a Reply