menu

CheatSheet

Here is a quick, pragmatic overview of a range of PM2 commands:

Install

$ npm install pm2 -g

Start an app

$ pm2 start app.js

Start and auto-restart on file change

$ pm2 start app.js --watch [--ignore-watch /*/]

List apps

pm2 list

Show extended infos

$ pm2 show <app_name>

Restart

$ pm2 restart app

Restart and update env

$ NODE_ENV=production pm2 restart app --update-env

Stop

$ pm2 stop app

Delete

$ pm2 delete app

Show logs

$ pm2 logs

Show env

$ pm2 env <pm_id>

Start PM2 at boot

$ pm2 startup

Set a name

$ pm2 start app.js --name="name"
# or update name
$ pm2 restart app --name="new-name"

Reset Restart Counters

$ pm2 reset all

Monitoring

$ pm2 monitor

Dump all process data

$ pm2 prettylist
# or
$ pm2 show <pm_id|app_name>