Charlie Jackson
Projects by Charlie Jackson
1 min readFeb 28, 2018

--

Originally Published: November 2016

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.

--

--

Charlie Jackson
Projects by Charlie Jackson

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