Skip to content

PM2 Cheat Sheet

pm2 is a process management tool that can be used to manage your node processes, view the status of node processes, and also supports performance monitoring, process guarding, load balancing, and other functions.

Fork Mode

Command Description
pm2 start app.js --name my-api Start and name a process

Cluster Mode

Command Description
pm2 start app.js -i 0 Will start the maximum number of processes for LB (scheduler) based on available CPUs

List

Command Description
pm2 list Show all process status
pm2 jlist Print process list in raw JSON
pm2 prettylist Print process list in beautified JSON
pm2 describe 0 Show all information related to a specific process
pm2 monit Monitor all processes

Logs

Command Description
pm2 logs [--raw] Show all process logs in stream mode
pm2 flush Clear all log files
pm2 reloadLogs Reload all logs

Operations

Command Description
pm2 stop all Stop all processes
pm2 restart all Restart all processes
pm2 reload all 0-second reload (for NETWORKED applications)
pm2 stop 0 Stop process with a specific ID
pm2 restart 0 Restart process with a specific ID
pm2 delete 0 Will delete process from pm2 list
pm2 delete all Will delete all processes from pm2 list

Miscellaneous

Command Description
pm2 reset <process> Reset metadata (restart time…)
pm2 updatePM2 Update pm2 in memory
pm2 ping Ensure pm2 daemon is started
pm2 sendSignal SIGUSR2 my-app Send system signal to script
pm2 start app.js --no-daemon Run pm2 daemon in foreground if it’s not already running
pm2 start app.js --no-vizion Skip vizion features (version control)
pm2 start app.js --no-autorestart Disable automatic restart of the application