Guides · terminal
How to find large files from the command line
By Lalla Asmaa Alaoui, founder of Mel · Updated
On Mac and Linux, find . -type f -size +100M lists every file over 100 MB below the current folder, and du -sh * | sort -h ranks the folders here by size. On Windows, a one-line PowerShell command does the same job.
Use the folder ranking to see where the space went, then the file search to find the culprits. Nothing below deletes anything; you decide what to remove once you can see it.
Mac and Linux
- Go to the folder you want to check.
cd ~/Projects- Rank what is in this folder by size.
du -sh * | sort -hdu -sh prints the total size of each item, and sort -h sorts human sizes such as 512K, 30M and 2.1G correctly. The biggest are at the bottom. Hidden folders such as .git or .cache are skipped by *, so also try:
du -sh .[!.]* | sort -h- Go one level deeper.
du -h -d 1 . | sort -h-d 1 limits the report to one level of folders. It works with both the Mac and Linux versions of du. Repeat from the largest folder until you find the heavy part.
- List large files directly.
find . -type f -size +100MChange +100M to +1G for files over a gigabyte, or +500k for over 500 KB. To see sizes next to the names:
find . -type f -size +100M -exec ls -lh {} +- Show the 20 largest files.
find . -type f -exec du -h {} + | sort -rh | head -n 20On a big folder this can take a while. Searching your whole home folder is fine; searching from / reads the whole disk and prints many "Permission denied" lines. Add 2>/dev/null to hide those.
- Find old large files. Combine size with age to find things you have not touched in a year:
find . -type f -size +100M -mtime +365Windows (PowerShell)
- List files over 100 MB, largest first.
Get-ChildItem -Recurse -File -ErrorAction SilentlyContinue |
Where-Object Length -gt 100MB |
Sort-Object Length -Descending |
Select-Object FullName, @{n='MB';e={[int]($_.Length / 1MB)}}-ErrorAction SilentlyContinue skips folders you cannot read. Change 100MB to 1GB for bigger files.
- Rank folders by size.
Get-ChildItem -Directory | ForEach-Object {
$size = (Get-ChildItem $_.FullName -Recurse -File -ErrorAction SilentlyContinue |
Measure-Object Length -Sum).Sum
[pscustomobject]@{ Folder = $_.Name; GB = [math]::Round($size / 1GB, 2) }
} | Sort-Object GB -DescendingIf you are in Command Prompt rather than PowerShell, run a PowerShell command from it with powershell -NoProfile -Command "...", or type powershell to switch.
Common space hogs
node_modulesfolders in old projects. Each one can be hundreds of megabytes, and they come back withnpm install.- Build output such as
target,distorbuild. - Docker images and caches.
docker system dfshows how much space Docker uses. - Downloads, disk images (
.dmg,.iso) and videos.
Move files to a "to delete" folder first and delete it a few days later. That gives you time to notice a mistake.
Doing it with Mel
In Mel, you can run every command above at the prompt. Each result becomes a block, and file paths in the output become links: ctrl+click (cmd+click on macOS) opens the folder or file. You can filter a long block to only the lines you care about.
You can also ask in plain English. Press ctrl+enter (cmd+enter on macOS) and write: "Find the 20 largest files under this folder and the folders using the most space. Do not delete anything." The agent can pick the right command for your system, run it and summarise the result. Commands that only read can run without a card. Moving or deleting files is a command that changes things, so with Mel's approvals it shows on an approval card you can deny.
FAQ
How do I find files larger than 1 GB? On Mac and Linux, run find . -type f -size +1G. In PowerShell, use the step 7 command with 1GB in place of 100MB.
Why does du show a different size than Finder or Explorer? du reports space used on disk, which depends on block size and compression. File managers often show the file's own length. Both are right; they measure different things.
How do I include hidden folders? du -sh .[!.]* covers hidden items on Mac and Linux. In PowerShell, add -Force to Get-ChildItem.
Is it safe to delete node_modules? Yes, in projects you can reinstall. Run npm install (or your package manager's install) to get it back.
Can an AI agent clean up disk space for me? It can find the large files and suggest what to remove. Keep deletes on approval and read each one.
Mel – the agentic terminal · openmel.dev. A multi-agent, multi-model AI terminal for Mac, Windows, Linux and VS Code. Free with your own API key.

Lalla is a hands-on tech founder, agentic infrastructure architect and the vision behind Mel.
Follow on LinkedIn