Freeing up storage in a dev machine

almirsarajcic

almirsarajcic

Created 7 months ago

If you’re like me, you’ve started many pet projects, but you stopped working on them because you didn’t have time and you’re a hoarder so you fooled yourself you’ll get back to them when you have time again. I’m all for it, but you can still do something about it. I suggest you remove the dependencies and the compiled code you’ll easily be able to reproduce.

Here’s how to do it.

Get into a directory that holds all your projects (for me it’s ~/Areas and ~/Projects), then run the following:

find . -name "_build" -prune -exec rm -rf '{}' +
find . -name "deps" -prune -exec rm -rf '{}' +
find . -name "node_modules" -prune -exec rm -rf '{}' +

I’ve had many abandoned projects so that freed up 50 GB on my machine.

I’ve also had some iOS projects, so I’ve run the command to remove the Cocoapods.

find . -name "Pods" -prune -exec rm -rf '{}' +

Removing ElixirLS might be useful too:

find . -name ".elixir_ls" -prune -exec rm -rf '{}' +

Bonus:

docker image prune
docker container prune

will remove unused Docker images and containers.