techinfoBiT
  • News
  • Startups
  • Tech
    • Internet
    • Security
  • WebMaster
    • All
    • GEO
    • SEO
    • Server & Hosting
    • Tools
    • WordPress
    'Sorry, This File Type Is Not Permitted for Security Reasons' How To Fix This Error in WordPress Website Development-techinfoBiT

    ‘Sorry, This File Type Is Not Permitted for Security Reasons’ How To Fix This Error in WordPress

    What is DMARC Record in DNS and Why It is Important For Email Security-techinfoBiT

    What is DMARC Record in DNS and Why It is Important For Email Security?

    How To Generate SHA-256 Hash From the Command Line on Ubuntu Server - techinfoBiT-SHA-256,Ubuntu Server, Server Solution, Linux Hashing, File Integrity, Cryptographic Hash, sha256sum, Hash Generation

    How To Generate SHA-256 Hash From the Command Line on Ubuntu Server

    Cloudflare To Deprecate Auto Minify Feature On August 5, 2024 - techinfoBiT

    Cloudflare To Deprecate Auto Minify Feature On August 5, 2024

    What is Google Analytics 4 and How to Setup GA4 for Websites - techinfoBiT

    What is Google Analytics 4 and How to Setup GA4 for Websites?

    How To Use Multiple SPF Records In A Domain | Merge Multiple SPF Easily - techinfoBiT

    How To Use Multiple SPF Records In A Domain | Merge Multiple SPF Easily

  • Science Space
  • Gadgets
    • Laptop & PCs
    • Mobile Phones
    • Wearables
  • More
    • How-To Guides
    • Reviews
    • Telecom
    • Applications
    • Press Release
No Result
View All Result
Services
techinfoBiT
  • News
  • Startups
  • Tech
    • Internet
    • Security
  • WebMaster
    • All
    • GEO
    • SEO
    • Server & Hosting
    • Tools
    • WordPress
    'Sorry, This File Type Is Not Permitted for Security Reasons' How To Fix This Error in WordPress Website Development-techinfoBiT

    ‘Sorry, This File Type Is Not Permitted for Security Reasons’ How To Fix This Error in WordPress

    What is DMARC Record in DNS and Why It is Important For Email Security-techinfoBiT

    What is DMARC Record in DNS and Why It is Important For Email Security?

    How To Generate SHA-256 Hash From the Command Line on Ubuntu Server - techinfoBiT-SHA-256,Ubuntu Server, Server Solution, Linux Hashing, File Integrity, Cryptographic Hash, sha256sum, Hash Generation

    How To Generate SHA-256 Hash From the Command Line on Ubuntu Server

    Cloudflare To Deprecate Auto Minify Feature On August 5, 2024 - techinfoBiT

    Cloudflare To Deprecate Auto Minify Feature On August 5, 2024

    What is Google Analytics 4 and How to Setup GA4 for Websites - techinfoBiT

    What is Google Analytics 4 and How to Setup GA4 for Websites?

    How To Use Multiple SPF Records In A Domain | Merge Multiple SPF Easily - techinfoBiT

    How To Use Multiple SPF Records In A Domain | Merge Multiple SPF Easily

  • Science Space
  • Gadgets
    • Laptop & PCs
    • Mobile Phones
    • Wearables
  • More
    • How-To Guides
    • Reviews
    • Telecom
    • Applications
    • Press Release
No Result
View All Result
techinfoBiT

Ubuntu Server: How To Find Largest File In Directory Recursively

Nishant Kumar by Nishant Kumar
March 24, 2025
Reading Time: 3 mins read
Share on FacebookShare on Twitter > XShare via WhatsAppShare on LinkedIn

When managing an Ubuntu Server, disk space can quickly become an issue, especially if large files accumulate unnoticed. If you need to identify the biggest file within a directory (including subdirectories), Linux provides several powerful command-line tools to help.

In this guide, we’ll explore different methods to find the largest file in a directory recursively, making it easy for even beginners to follow along.

You might also like

Synology DS File Upload Reaches 100percent Then Fails? Failed to Upload Files on NAS - techinfoBiT

Synology DS File Upload Reaches 100% Then Fails? Failed to Upload Files on NAS

June 13, 2026
How to Install Let's Encrypt SSL on Ubuntu 24.04 VPS, Free HTTPS for All Website - techinfoBiT

How to Install Let’s Encrypt SSL on Ubuntu 24.04 VPS, Free HTTPS for All Websites

June 3, 2026

Step 1: Open the Terminal Application

  • First, you need to open a terminal on your Ubuntu Server. If you are connected via SSH, simply log in to your server.

Step 2: Switch to Root User

  • For full access, switch to the root user by running:
sudo -i
  • Enter your password if prompted.

Method 1: Using the du Command with Sorting

  • A simple and effective way to find the largest files is to use the du command in combination with sort and head.
du -a /path/to/directory/ | sort -n -r | head -n 20

Explanation:

  • du -a /path/to/directory/ → Estimates file space usage for all files and directories.
  • sort -n -r → Sorts files numerically (-n) in reverse order (-r), showing the largest files first.
  • head -n 20 → Displays the top 20 largest files.

Method 2: Using the find Command

  • The find command is a powerful tool for locating files based on size, modification time, and other attributes. To find the largest file in a directory recursively, use:
find /path/to/directory -type f -exec du -h {} + | sort -rh | head -n 1

Explanation:

  • find /path/to/directory -type f → Searches for all files in the specified directory and its subdirectories.
  • -exec du -h {} + → Uses the du (disk usage) command to display the sizes of files in a human-readable format.
  • sort -rh → Sorts the files in descending order based on size (-r for reverse order, -h for human-readable sorting).
  • head -n 1 → Displays the first (largest) file.

Method 3: Using ncdu for an Interactive View

  • If you prefer a user-friendly and interactive approach, install and use ncdu:
sudo apt install ncdu -y
ncdu /path/to/directory

Explanation:

  • ncdu scans the directory and presents an interactive interface where you can navigate and identify large files easily.

Bonus: Finding and Deleting Large Files

  • If you need to find and remove large files, use:
find /path/to/directory -type f -size +500M -exec rm -i {} \;
  • This will locate all files larger than 500MB and prompt you before deletion.

Conclusion:

By using du, find, and ncdu, you can quickly locate large files that may be consuming valuable disk space on your Ubuntu Server. These methods ensure efficient disk space management and keep your server running smoothly.

For more Linux and server management support, visit our Hosting and Server Admin Service.

Disclaimer: Portions of this content were enhanced with the assistance of ChatGPT.

Tags: Ubuntu Server
ShareTweetSendShare
Previous Post

boAt Amplifies the T20 Season 2025 as the Official Audio Partner for RCB & GT

Next Post

MeitY to Host India’s First Nano Electronics Roadshow at IISc Bengaluru

Nishant Kumar

Nishant Kumar

Nishant is a passionate tech blogger and has been writing about technology since 2007. His insatiable love for gadgets has made him closely follow the advancements & innovations our society has made in terms of technology since a long while now. Nishant is a highly sought after reviewer with many manufacturers requesting his opinions about their products. He covers Mobile Phones, Gadgets, Tools and all kind of tech products to give consumers Genuine Reviews, Buying Guides and reliable news.

Related Articles

Synology DS File Upload Reaches 100percent Then Fails? Failed to Upload Files on NAS - techinfoBiT

Synology DS File Upload Reaches 100% Then Fails? Failed to Upload Files on NAS

by Nishant Kumar
June 13, 2026
0

Many Synology NAS users encounter a frustrating issue when uploading files via DS File. The upload appears to complete successfully, reaches 100%, enters the "Processing" stage, and then suddenly fails...

How to Install Let's Encrypt SSL on Ubuntu 24.04 VPS, Free HTTPS for All Website - techinfoBiT

How to Install Let’s Encrypt SSL on Ubuntu 24.04 VPS, Free HTTPS for All Websites

by Nishant Kumar
June 3, 2026
0

One of the final and most important steps when launching a website or web application is enabling HTTPS. Whether you're hosting a WordPress website, a Spring Boot application, a Laravel...

How to Deploy a Spring Boot Application with PostgreSQL on Ubuntu 24.04 VPS-techinfoBiT

How to Deploy a Spring Boot Application with PostgreSQL on Ubuntu 24.04 VPS

by Nishant Kumar
June 2, 2026
0

Deploying a Spring Boot application on a VPS involves more than simply uploading application files to a server. A production deployment typically includes a Java runtime, a PostgreSQL database, a...

how to type in Hindi 2026, Hindi typing Windows 11, Google Input Tools alternative, type in Indian languages, Hindi phonetic keyboard Windows, Microsoft Indic Language Input Tool, Gboard Hindi typing-techinfoBiT

How to Type in Hindi and Indian Languages on Any Device in 2026

by techinfoBiT
May 31, 2026
0

If you have been searching for the Google IME offline installer lately, you already know the bad news. Google quietly discontinued the Windows installer years ago. The download links are...

Load More
Next Post
MeitY to Host India's First Nano Electronics Roadshow at IISc Bengaluru-techinfoBiT

MeitY to Host India's First Nano Electronics Roadshow at IISc Bengaluru

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *


This site uses Akismet to reduce spam. Learn how your comment data is processed.

techinfoBiT | Startup & Tech News, Reviews | WebMaster, How-To Guides-Tech Blog-Startup Blog India

techinfoBiT is your go-to source for the latest startup & tech news, technology reviews; WebMaster, SEO tips and how-to guides to help you stay updated and navigate the digital world know more

  • About
  • Contacts
  • Disclaimer
  • Privacy Policy

© 2012-2025 techinfoBiT | All Rights Reserved

No Result
View All Result
  • News
  • Startups
  • Tech
  • WebMaster
  • Gadgets
  • How-To Guides
  • Science Space
  • Services

© 2012-2025 techinfoBiT | All Rights Reserved