Managing disk space on your development machine/server can be pretty annoying if you don't know where to start. In this article I've compiled some important places to check, especially if your environment includes Docker, Python or Node.
Useful commands
- Use
df -hto see the full disk usage - Use
du -sh <folder-name>to see the size of a certain folder
Development environment
Docker
docker system df- prints the size of images, containers and cachedocker builder prune- clears docker cache, used for image building (doesn't remove anything important)
Conda
conda clean --all- clean up all files that were left by removed environmentsconda info --envs- list all environmentsconda remove -n <env-name> --all- remove any unused environments
NVM
rm -rf ~/.nvm/.cache- clean nvm cache
MacOS
- To look up which files on your system are taking the most space go to
Settings > Storage > Documents > File browser. Then navigate the tree and remove unnecessary files rm -rf ~/Library/Caches/*- deletes temporary caches for programs (you might have to re-log in)
Brew
- Remove abandoned dependencies
brew autoremove - Cleanup
brew cleanup --prune=all --dry-run
Linux
rm -rf /tmp/*- remove temporary files
Journal logs:
journalctl --disk-usage- see the disk usage for logssudo journalctl --vacuum-time=7d- remove logs older than 7 days
APT
sudo apt-get cleanandsudo apt-get autoclean- clean up unused files- Remove unnecessary packages:
sudo apt-get --dry-run autoremove --purgesudo apt-get autoremove --purge