Skip to content

Instantly share code, notes, and snippets.

@jehna
Created September 28, 2017 21:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jehna/c89cb7eb7ec1e8a7cf15cde39a0b50b3 to your computer and use it in GitHub Desktop.
Save jehna/c89cb7eb7ec1e8a7cf15cde39a0b50b3 to your computer and use it in GitHub Desktop.
Free up disk space by removing node_modules
# Check how much space you would save by removing all node_modules folders under this folder
find . -regex '.*/node_modules$' -type d | grep -v 'node_modules/' | xargs du -ch | tail -1
# Remove all node_modules folders found inside this directory
# Thank you for @lehtu for the original script
find . -regex '.*/node_modules$' -type d | grep -v 'node_modules/' | xargs rm -r
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment