October 5, 2024
Tutorials

How to See Large Files in Linux

See large files in Linux


Checking for files occupying large space is important for your Linux machines. Unnecessary large files can slow down your system, therefore you should manage disk space by removing it, if necessary.

This will create space for essential files and applications, thus it helps to improve system performance and run your system smoothly.

This post aims to explore the commands and tools to see large files in Linux-based systems, including Ubuntu 24.04.

How to See Large Files in Linux (Ubuntu 24.04)?

These topics will improve your understanding to see large files in Linux:

How to See Large Files in Linux through Terminal?

How to See Large Files in Linux via Graphical Interface (GUI)?

How to See Large Files in Linux through Terminal?

The following commands will be utilized in the terminal to see and analyze large files in Linux.

1: Check Files Size using “df”

The following “df -h” command is used to print the file size or disk usage of all mounted filesystems:

df -h

The above command shows the quick summary of files and disks occupying large space. This can help you quickly analyze how much space is left on your drives.

2: Listing Largest Files with “ls”

The following “ls” command can be utilized to list the largest files in the root directory (/) by file size:

ls -lhS / | head -n 10

The “-lhS” options are used to list files (-l), display sizes in a human-readable form(-h), and sort by the file size (-S) in your system’s root directory. You can also see that the largest file is at the top of the list.

3: Sort the Largest Files with “du”

The command present below is a useful command to search and print the largest files on your Linux-based system (i.e. Ubuntu 24.04):

sudo du -ah | sort -rh | head -n 20

This command helps identify large files that may need to be cleaned up to free up disk space if necessary.

4: Check the Largest Files in the Root Directory via “du”

Run this command to check and identify the files and directories occupying large amounts of disk space on your system’s root directory:

sudo du -ah / | sort -rh | head -n 20

This command will sort the large files and directories and show them on your terminal screen from largest (6.3GB) to smallest files (1.3 GB).

5: See the Largest Files using “find”

You can utilize the “find” command in the following format, to check the largest files across the whole filesystem and sort and display them on the screen:

sudo find / -type f -exec du -h {} + | sort -rh | head -n 10

See the largest files using find command

This command is particularly used to see and display the largest individual files, not directories on your Ubuntu 24.04 system.

Note: If you want to see the largest files individually, use the “find” command. If you want a broader overview of space usage, including files and directories, use the “du” command.

How to See Large Files in Linux via Graphical Interface (GUI)?

You can use the “Disk Usage Analyzer”, a GUI tool, to see large files on a Linux-based Ubuntu 24.04 system.

Step 1: Open Disk Usage Analyzer

The Disk Usage Analyzer is a built-in tool in Linux systems, used for inspecting a visual view of disk space usage on your system. Access the Disk Usage Analyzer from the Ubuntu Apps, as shown below:

Disk Usage Analyzer

Step 2: Select the Disk or Directory

Within the Disk Usage Analyzer, and select the particular disk or directory that you want to analyze for large files:

Step 3: See Large Files

You will see the visual chart of the files. The various colors represent different levels of disk usage. You can further analyze by clicking on the particular file or color:

Bonus tips:

The following options are used:

/

Root Directory

-a

All files and directories

-h

Human-readable format

-r

Reverse order

Conclusion

In Ubuntu 24.04, checking for large files can be done using command-line tools and graphical interfaces. The “du” and “find” commands are commonly used to check detailed disk usage, including file sizes. Alternatively, the “Disk Usage Analyzer” is a graphical tool that allows you to inspect large files on your Linux system.

Leave feedback about this

  • Quality
  • Price
  • Service

PROS

+
Add Field

CONS

+
Add Field
Choose Image
Choose Video