Graphic representation of Emily showcasing a Shell script for Automatically Running nvm use, symbolizing the fusion of convenience and efficiency in managing Node versions in different project directories.

Welcome back to another edition of TWIL, our weekly series where we serve up bite-sized pieces of wisdom to spice up your tech know-how. This week, join Emily as she introduces a nifty Shell script to Automatically Run nvm use, a smart way to ensure the right Node version with a helpful nvm use command embedded in directory changesโ€”a true lifesaver for those seeking command line efficiency. Stay tuned as Emily demonstrates the ease of integrating this tweak into your workflow. With her tips, managing Node environments becomes as simple as hopping into a directory, perfect for the forgetful among us keen on keeping our Shell game strong.

Automatically Run nvm use Shell Function

Recently I've found myself forgetting to run nvm use , so I decided to add it to my usual cl function.

Here's the basic version:

# A function used as a more advanced version of `cd`
# - Changes into the specified directory
# - If an .nvmrc file exists, active it using `nvm use`
function cl () {
  cd "$@"

  if test -f ".nvmrc"; then
    echo "๐Ÿ”Ž๐Ÿ”Ž๐Ÿ”Ž .nvmrc found - activating Node environment\n"
    nvm use
  fi
}

And my full cl command:

# A function used as a more advanced version of `cd`
# - Changes into the specified directory
# - Clears the screen
# - If an .nvmrc file exists, active it using `nvm use`
# - Lists the current directory
function cl () {
  cd "$@" && clear
  
  if test -f ".nvmrc"; then
    echo "๐Ÿ”Ž๐Ÿ”Ž๐Ÿ”Ž .nvmrc found - activating Node environment\n"
    nvm use
  fi

  ls -laAhF
}
  • Shell
  • Bash
  • Helpers
  • Node.js
Emily Morehouse's profile picture
Emily Morehouse

Cofounder, Director of Engineering

Related Posts

AWS logo centered over dark blue stylized map of Europe with concentric radar-style rings emanating from Germany, representing the AWS European Sovereign Cloud infrastructure launch for EU data sovereignty and GDPR compliance
January 26, 2026 โ€ข Frank Valcarcel

AWS Launches European Sovereign Cloud

AWS launched a physically separate cloud infrastructure in Europe with EU-only governance, zero US dependencies, and over 90 services. Here is what organizations in healthcare, finance, and government need to know about the sovereign cloud and how to evaluate it for their compliance strategy.

MCP (Model Context Protocol) logo โ€” a stylized white interlinked letter mark โ€” centered on an abstract background of flowing purple and orange gradient waves, representing AI connectivity and data integration.
November 25, 2025 โ€ข Frank Valcarcel

Anthropicโ€™s Model Context Protocol: The Standard for AI Tool Integration

A year after launch, Anthropic’s Model Context Protocol has become the universal standard for connecting AI agents to enterprise tools. Backed by OpenAI, Google, Microsoft, and the Linux Foundation. Here’s what developers need to know.

Let's work together

Tell us about your project and how Cuttlesoft can help. Schedule a consultation with one of our experts today.

Contact Us