Environment variables of a running process on Unix?

cat /proc/<pid>/environ

If you want to have pid(s) of a given running executable you can, among a number of other possibilities, use pidof:

AlberT$ pidof sshd   
30690 6512 

EDIT:

I totally quote Dennis Williamson and Teddy comments to achieve a more readable output.
My solution is the following:

tr '\0' '\n' < /proc/<pid>/environ

Leave a Comment