Get Node.js Port Using PM2 Name
View on Twitter
💡 I recently needed to get the port of a @nodejs process from its PM2 name with a one-liner:
➡️ ss -ntlp | grep $(pm2 ls | grep <app_name> | awk '{print $12}') | awk '{print $4}' | grep -oP '(?<=:)[0-9]{2,}'