Skip to content

Instantly share code, notes, and snippets.

@jlecour
Last active March 2, 2016 09:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jlecour/0fb96f651051c7d1f908 to your computer and use it in GitHub Desktop.
Save jlecour/0fb96f651051c7d1f908 to your computer and use it in GitHub Desktop.
Pretty prints the environment of execution of a program by its PID.

Give pidenv the PID of a running program and it will print (with correct line breaks) its environment.

# pidenv 1
HOME=/
TERM=linux
BOOT_IMAGE=/bzImage-3.14.32-xxxx-grs-ipv6-64
#!/bin/sh
pid="$1"
tr '\000' '\n' < /proc/$pid/environ
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment