Skip to content

How To See A Process’s Environment in Linux

One of our sysadmins recently taught me that we can see the environment with which a process is launched by looking in /proc. Whoa! That’s helpful.

Unfortunately, the environment file is null terminated so not pleasant to read or pipe together with other commands. So here’s a handy one-liner to print them “properly” for easier inspection or command chaining.

cat /proc/{pid}/environ | xargs --null --max-args=1 echo

#protip #selfreference

Posted in Tech Reference.

0 Responses

Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.

Some HTML is OK

or, reply to this post via trackback.


Log in here!