Python script for pretty-printing the environment variables for one or more processes.
- Python 3
- psutil library
Ensure you have Python 3 installed:
python3 --versionInstall the psutil package:
pip3 install psutilThe easiest way to use this script is install it to a location on your path $PATH, e.g. /usr/local/bin (sudo or admin access may be required):
curl -sLf --retry 3 --tlsv1.2 --proto '=https' 'https://raw.githubusercontent.com/DopplerUniversity/process-env-vars/main/process-env-vars.py' | sudo tee /usr/local/bin/process-env-vars &>/dev/null
sudo chmod +x /usr/local/bin/process-env-varsThen test by running:
process-env-vars --help- All process name-based filters are case sensitive
- All arguments except
--jsonsupport multiple instances, e.g.--pid 58327 --pid 58325 - Using
--pid,--name(or a mix of both) short-circuits--filterand--ignore - Using
--usernametakes precedence over all other filters
Note:
- Some processes require
sudoor admin access to fetch their environment variables - Zombie processes do not return environment variables
Below are the most common usage examples for finding and filtering the process list:
Filter by user:
process-env-vars --user rbMatch using process ID:
process-env-vars --pid 58325Match using multiple processes by ID:
process-env-vars --pid 58327 --pid 58325Filter with exact match for process name:
process-env-vars --name FigmaFilter by exact process name:
process-env-vars --name figma_agentFind processes where process name contains the supplied value:
process-env-vars --filter figmaFind processes where process name contains either of the supplied values:
process-env-vars --filter Figma --filter figmaIgnore processes where process name contains the supplied value:
process-env-vars --ignore ChromeIgnore processes where process name contains either of the supplied values:
process-env-vars --ignore Chrome --ignore ElectronOutput to JSON format:
process-env-vars --filter Electron --json