running shell scripts in the background

2020-02-12

 | 

~1 min read

 | 

119 words

Continuing my recent trend of finding useful tips and tricks in the command line. Today, it was how to run multiple processes in parallel within one terminal session (i.e. one tab) by running them in the background.

The easiest way to do this is to chain the commands together with a single ampersand(&).

For example, imagine a project with a frontend and backend that are run via two scripts:

  1. npm run web
  2. npm run server

To run them both within the same terminal session, run the command: $ npm run web & npm run server. This will put the web in the background.

Once the processes are running, you can monitor them with top or htop.


Related Posts
  • Package Discovery: Npm-Run-All
  • Bring The Background Job Back To The Foreground


  • Hi there and thanks for reading! My name's Stephen. I live in Chicago with my wife, Kate, and dog, Finn. Want more? See about and get in touch!