Search for where an environment variable is defined across:
- System-wide shell init (/etc/bashrc, /etc/profile, etc.)
- User shell init files (~/.bashrc, ~/.bash_profile, etc.)
- PAM environment (/etc/security/)
- systemd unit files (Environment= and EnvironmentFile= directives, with recursive scanning of referenced files)
- Sysconfig / app dirs (/etc/sysconfig/, /etc/default/, /etc/conf.d/)
- Live processes (/proc/*/environ, own user only without root)
- Running Docker containers (via docker inspect)
ℹ️ Script is mostly generated by LLM with some manual tweaks
$ ./env_var_explorer.sh AIRFLOW_HOME
=== System-wide shell init ===
✔ /etc/environment
1:AIRFLOW_HOME=/home/airflow/airflow
=== User shell init files ===
=== PAM environment ===
=== systemd unit files ===
✔ /etc/systemd/system/airflow-webserver.service
10:Environment="AIRFLOW_HOME=/home/airflow/airflow"
✔ /etc/systemd/system/airflow-flower.service
10:Environment="AIRFLOW_HOME=/home/airflow/airflow"
✔ /etc/systemd/system/airflow-scheduler.service
10:Environment="AIRFLOW_HOME=/home/airflow/airflow"
(skipped — not readable: /etc/sysconfig/sshd)
(skipped — not readable: /etc/sysconfig/crond)
(skipped — not readable: /etc/sysconfig/sshd)
=== Application / sysconfig files ===
=== Live processes with AIRFLOW_HOME in their environment ===
✔ PID 17831 (python3) ← PPID 1 (systemd)this
AIRFLOW_HOME=/home/airflow/airflow
✔ PID 17831 (bash) ← PPID 17829 (sshd)this
AIRFLOW_HOME=/home/airflow/airflow
=== Running Docker containers ===
(docker not found in PATH, skipping)
────────────────────────────────────
Found! See matches above.
Some locations were skipped (not readable as current user).
Re-run with sudo for full coverage.