How to Find and Delete Large Files on Your Linux Server
A full disk can bring a server to a halt, and the fastest way out is to find the biggest files and clear what you do not need. Linux gives you simple commands to hunt down space hogs precisely, so you are never deleting blindly.
You will need SSH access. First, if you have not already, see checking disk usage with df and du to find the full area.
Step 1: Find the largest files
To list the ten biggest files under a folder:
find /home -type f -printf '%s %p\n' | sort -nr | head
Or, more readably, use du to find large files anywhere under a path:
du -ah /home | sort -hr | head -20
This surfaces the biggest files and folders, largest first, so you can see exactly what to target.
Step 2: Look before you delete
Confirm what each large file is before removing it. Old backup archives, forgotten log files and stray database dumps are usually safe. System files and anything a live service depends on are not.
Step 3: Delete safely
Remove a specific file with:
rm /path/to/large-old-backup.tar.gz
For a log a service is still writing to, do not delete it — empty it instead:
truncate -s 0 /var/log/somefile.log
A safer long-term fix
If logs keep filling the disk, set up log rotation so they are trimmed automatically. And if old backups are the cause, move them off the server — our guide on transferring files between servers with rsync is ideal for shipping them to storage.
Frequently asked questions
I deleted files but df still shows the disk full.
A process may still be holding a deleted file open. Restart the service that owns it (or the server) to release the space. This is the most common cause of "I deleted it but nothing changed".
Is there a risk in using rm?
Yes — rm is permanent with no recycle bin. Double-check the path, avoid wildcards unless you are certain, and never run a broad delete on system directories. When unsure, move files aside rather than deleting.
Can I do this on shared hosting?
Use cPanel's File Manager to sort by size and remove files instead. These shell commands are for VPS and dedicated servers.
Was this article helpful?