Skip to content

Instantly share code, notes, and snippets.

@LouiseMcMahon
Created July 21, 2017 08:14
Show Gist options
  • Save LouiseMcMahon/e3720a2a24c1d0e9d79645ea958e40f0 to your computer and use it in GitHub Desktop.
Save LouiseMcMahon/e3720a2a24c1d0e9d79645ea958e40f0 to your computer and use it in GitHub Desktop.
List unused node versions in NVM
#This will list all node versions without an alias
$(nvm list | grep -v -e "->" | grep -P "(v\d+\.\d+\.\d+)" -o)
#This uses the above to find and remove node versions in NVM without an alias
for version in $(nvm list | grep -v -e "->" | grep -P "(v\d+\.\d+\.\d+)" -o)
do
nvm uninstall $version
done
@guidop91
Copy link

I wanted to declutter my unused node versions, thank you for this 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment