Skip to content

PM2 Cheat Sheet

PM2 is a process management tool that you can use to manage your Node.js processes and view their status. It also supports features like performance monitoring, process guarding, and load balancing.

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 Starts the maximum number of processes for LB (scheduler) based on available CPUs

Listing

Command Description
pm2 list Show status of all processes
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] Display all process logs in stream format
pm2 flush Clear all log files
pm2 reloadLogs Reload all logs

Action

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

Miscellaneous

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