🚀 Intelligence & Tech Deals for Creators & Solopreneurs
Business Legions Blog

HOW TO FIND THE LARGEST FILES OR DIRECTORIES ON YOUR VPS

HOW TO FIND THE LARGEST FILES OR DIRECTORIES ON YOUR VPS

My CentOS VPS was running out of space so I needed to do a bit of a clean up and decided to see which files and directories used up the most space. So after some digging around I found these two commands.

This one is to find the largest 10 directories:

find . -type d -print0 | xargs -0 du | sort -n | tail -10 | cut -f2 | xargs -I{} du -sh {}

Business Legions Find Largest Directories

This one is to find the largest 10 files:

find . -type f -print0 | xargs -0 du | sort -n | tail -10 | cut -f2 | xargs -I{} du -sh {}

Business Legions Find Largest Files

If you want to display more than 10 results then change the tail -10 to another amount. I then found a couple of large xml files and deleted these which freed up over 2 GB of data.

 

Verified Partners Featured Directory

Our Featured Sponsors & Partners

Discover vetted software platforms, SaaS toolkits, and services supporting the Business Legions community.

The Simple Entrepreneur

The Simple Entrepreneur

Founder, developer, and lifestyle entrepreneur sharing real-world frameworks, software automations, and curated deals. Read more at marcotran.com.au.

Tech Intelligence

Want deeper blueprints like this?

Subscribe to Business Legions Intelligence for weekly tactical breakdowns and verified lifetime software deals.