loading...
Cover image for [JS] This command will help you to free some disk space

[JS] This command will help you to free some disk space

gugacavalieri profile image Guga Cavalieri ・1 min read

My work laptop has an small SSD Disk (128 GB) so I often receive some system notifications alerting me that my /home is running low on disk space.

After some digging I found out that many projects under my /dev folder had a node_modules folder inside eating up a bunch of space.

So I needed a magical command to remove these folders recursively and here is what I found in my first Google search result:

Clear all node_modules Directories | Mac and Linux

  1. Open your terminal.
  2. Browse to your master project directory or the top level of where you have a bunch of projects stored.
  3. Run the command: find . -name "node_modules" -type d -prune -exec rm -rf '{}' +
  • (Optional) Create an alias (node-modules-clean)

This helped to free up 5GB on my SSD. Hope it helps you too :)

Source: rtmccormick.com

Posted on by:

gugacavalieri profile

Guga Cavalieri

@gugacavalieri

Software Engineer @ Kudos linux and open-source software enthusiast 🧡 contributor @freeCodeCamp ⛺

Discussion

pic
Editor guide