Charlie Jackson
Feb 28, 2018 · 1 min read

Originally Published: November 2016

Global commands image
Global commands image

Key Facts

  • NPM module for running commonly used commands
  • Run these commands from any directory
  • Setup via a config file on your desktop
  • See the repo here on GitHub.

Run commands from any directory. Tired of changing directory all the time in the terminal? Add all your frequent commands into a .globalCommands file on your desktop and run them from within any directory. This package runs in Node.js, so get download the latest version and install this package with:

npm install -g global-commands

Now you can setup your frequent commands file. Add a file named .globalCommands to your desktop and base it off the following:

{
"test": "echo 'global command'",
"startMyProject": {
"directory": "/Users/username/Documents/Code/Projects/myProject",
"command": "npm start"
}
}

The file must be a valid JSON object. Each entry must be the command name followed be either:

The command or

An object specifying the directory to run the command from, and the command itself.

You can now run the commands using:

globCom test

globCom startMyProject

etc.

Projects by Charlie Jackson

Personal and Professional Projects by Charlie Jackson

Charlie Jackson

Written by

Freelance JavaScript Developer. Sometimes write about self development, tech and startup stuff.

Projects by Charlie Jackson

Personal and Professional Projects by Charlie Jackson

More From Medium

Also tagged Programming

Also tagged Open Source

Also tagged Programming

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade