How to display /proc/*/environ file in separate lines?

Written by Yujin Boby

Edit in WordPress

environ is a file located in /proc/PID/environ, it shows environment variables for a process.

If you run “cat environ”, you will get a long string.

linux proc evviron file

To make it readable, you can use sed command.

cat environ | sed -z 's/$/\n/'
cat cmdline | tr '\0' ' ' ; echo

Example

linux procs environ display with sed