• Contact
  • About Me
  • Privacy Policy
  • Disclaimer
DefenceDev
  • Home
  • Blog
  • Linux Tutorials
    • Bash Scripting Lessons
    • Commands
    • Networking
    • Bash Scripts
  • Solutions
    • Docker
  • Network Tutorials
    • FortiGate
    • MikroTik
  • Projects
    • AdGuard
    • Immich
    • Nextcloud
    • WordPress
  • Cloud
  • Video Tutorials
    • YouTube Channel
    • MikroTik Videos
  • Web Tools
No Result
View All Result
  • Home
  • Blog
  • Linux Tutorials
    • Bash Scripting Lessons
    • Commands
    • Networking
    • Bash Scripts
  • Solutions
    • Docker
  • Network Tutorials
    • FortiGate
    • MikroTik
  • Projects
    • AdGuard
    • Immich
    • Nextcloud
    • WordPress
  • Cloud
  • Video Tutorials
    • YouTube Channel
    • MikroTik Videos
  • Web Tools
No Result
View All Result
DefenceDev
No Result
View All Result
ADVERTISEMENT
Home Solutions

Find the Largest Files and Folders on Linux

neo by neo
September 11, 2025
in Solutions
0
Find the Largest Files and Folders on Linux

Find the Largest Files and Folders on Linux

0
SHARES
34
VIEWS
Share on FacebookShare on Twitter
Table of Contents
  • Find the Largest Files or Folders
    • Command to list 10 Biggest Folders
    • Understanding Disk Usage with du -skh *

Find the Largest Files or Folders

Find the Largest Files and Folders on Linux is one of the essential tasks for any Linux user or administrator. It is very important is keeping an eye on disk space usage. The du command (short for disk usage) is an incredibly useful tool that helps analyze the size of files and directories. In this article, we’ll cover two common use cases: using du -skh * to check the sizes of files and directories in the current folder, and du -ah /path/to/folder | sort -rh | head -n 10 to find the largest files or folders in a directory.

Command to list 10 Biggest Folders

du -ah /path/to/folder | sort -rh | head -n 10

When you need to identify the largest files or directories in a specific path, the combination of du, sort, and head is incredibly useful. Here’s a breakdown of the command:

  • du -ah /path/to/folder: Shows the size of all files and directories recursively within the specified folder in human-readable format.
    • -a: Includes files in the output, not just directories.
    • -h: Displays sizes in a human-readable format.
  • sort -rh: Sorts the output by size in reverse order, showing the largest items first.
    • -r: Reverse order (largest to smallest).
    • -h: Sorts by human-readable sizes (KB, MB, GB).
  • head -n 10: Limits the output to the top 10 largest files or directories.

Example Output:

7T    /data/a/
3T    /data/a/folder1
2T    /data/a/folder2
1G    /data/a/folder3
1G    /data/a/folder4

When to Use du -ah /path/to/folder | sort -rh | head -n 10

This command is ideal for identifying large files or folders that are consuming a significant portion of your disk space. It’s especially useful for pinpointing storage hogs in larger directories, helping you prioritize what to clean up.

Understanding Disk Usage with du -skh *

du -skh * | sort -rh

The command du -skh * is a quick way to check the disk usage of all items (files and directories) in your current folder. Here’s how it works:

  • du: The disk usage command.
  • -s: Summarizes the total size of each file or directory instead of showing sizes for every subdirectory.
  • -k: Outputs the size in kilobytes.
  • -h: Makes the output more human-readable, showing sizes in KB, MB, or GB, depending on the file size.
  • *: Represents all files and directories in the current folder.
  • sort -rh: Sorts the output by size in reverse order, showing the largest items first.
    • -r: Reverse order (largest to smallest).
    • -h: Sorts by human-readable sizes (KB, MB, GB).

Example Output:

300M  backup_file.tar.gz
4.5M  project_folder
12K   script.sh

This output shows that script.sh takes up 12KB, project_folder uses 4.5MB, and backup_file.tar.gz occupies 300MB of space.

When to Use du -skh *

This command is perfect for getting a quick snapshot of how much space each file or directory in your current folder is using. It’s an ideal starting point when trying to clean up disk space.

More example how to use du command you can find on the following link.

ADVERTISEMENT
ADVERTISEMENT

A very useful application for monitoring disk space is ncdu. You can find out how it works on the link.

Find the Largest Files and Folders on Linux

About The Author

neo

See author's posts

Tags: linux
ADVERTISEMENT
Previous Post

MikroTik: Configure Router with Winbox Application

Next Post

Linux Networking: Display Open Ports and Listening Services

neo

neo

Related Posts

Automatic Windows Service Monitoring and Restart Script
Solutions

Automatic Windows Service Monitoring and Restart Script

Host a Website on Raspberry Pi – Real Benchmark Tests
Solutions

Host a Website on Raspberry Pi – Real Benchmark Tests

My Ultimate Docker Command Cheat Sheet (2025 Edition)
Docker

My Ultimate Docker Commands Cheat Sheet (2025 Edition)

Protect Docker-Hosted Application from HTTP Flood (DDoS) Attacks Using a Bash Script
Docker

Protect Docker-Hosted Application from HTTP Flood (DDoS) Attacks Using a Bash Script

Raspberry Pi Monitoring with Monit: Docker, Temperature, Network & More
Solutions

Raspberry Pi Monitoring with Monit: Docker, Temperature & More

Install WordPress on Raspberry Pi 4 with Docker (Ubuntu 22.04)
Docker

Install WordPress on Raspberry Pi 4 with Docker (Ubuntu 22.04)

Next Post
Linux Networking: Display Open Ports and Listening Services

Linux Networking: Display Open Ports and Listening Services

Recommended

Nextcloud: Security Concept with FortiGate Firewall

Nextcloud: Security Concept with FortiGate Firewall

Nextcloud: My Experience Collected in 2 Years of Use

Nextcloud: A Two-Year User Experience Review

View & Copy Image Metadata Online – Camera & GPS Info

View & Copy Image Metadata Online – Camera & GPS Info

Online WebP to JPG Converter

Online WebP to JPG Converter

Image Metadata Remover – Clean EXIF and GPS Info Securely

Image Metadata Remover – Clean EXIF and GPS Info Online

Categories

  • Blog
  • Cloud
    • Private
  • Linux Tutorials
    • Bash Scripting Tutorials
    • Commands
    • Networking
  • Network Tutorials
    • FortiGate
    • MikroTik
  • Projects
    • AdGuard
    • Immich
    • Nextcloud
    • WordPress
  • Solutions
    • Docker
  • Video Tutorials
    • MikroTik Videos
  • Web Tools
ADVERTISEMENT

DefenceDev Tutorials

defencedev Logo

Whether you’re just starting or looking to expand your skills, I hope you find useful information and engaging discussions here. Let me take you through my journey and the goals behind this space!

Follow Us

Recent News

View & Copy Image Metadata Online – Camera & GPS Info

View & Copy Image Metadata Online – Camera & GPS Info

Online WebP to JPG Converter

Online WebP to JPG Converter

  • Site Map
  • Privacy Policy
  • Facebook Page
  • Disclaimer
  • Contact
  • About Me

© 2025 defencedev.com - All rights reserved.

No Result
View All Result
  • Home
  • Blog
  • Linux Tutorials
    • Bash Scripting Lessons
    • Commands
    • Networking
    • Bash Scripts
  • Solutions
    • Docker
  • Network Tutorials
    • FortiGate
    • MikroTik
  • Projects
    • AdGuard
    • Immich
    • Nextcloud
    • WordPress
  • Cloud
  • Video Tutorials
    • YouTube Channel
    • MikroTik Videos
  • Web Tools

© 2025 defencedev.com - All rights reserved.