Where can I find the ports of all running pm2 apps?

Yeah this is a bit of a failing with pm2 IMHO. Only when you have more than one instance (site) running on the server.
I use:

ss -tnlp | grep "node /"

You can then eyeball the pid from pm2 and the port, or in my case you get just a snippet of the directory it’s running from.
UPDATE: you can use this monstrosity:

ss -ntlp | grep $(pm2 ls | grep "SITENAME" | awk '{print $10}') | awk '{print $4}'

Which dumps the port out.

The OP added a comment saying he added the port number into the name of the running node app, which could get messy, but is a good idea.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)