Set system-wide environment variables for all login shells with a single file. 16.11.2025 | reading time: 2 min Want a single place to set PATH and environment variables for every user at login? Edit /etc/profile to export variables and adjust PATH so login shells inherit a consistent environment across the system. Hands-on example Do this: add a variable and make it available system-wide by running `echo 'export MYAPP_HOME=/opt/myapp' | sudo tee -a /etc/profile` then activate it in the current session with `source /etc/profile`; verify with `echo $MYAPP_HOME` which should print `/opt/myapp`. Common pitfalls Remember that /etc/profile runs for login shells only; interactive non-login shells often read ~/.bashrc instead, so test changes with `su -` or a fresh SSH login; avoid clobbering PATH—use `export PATH="/opt/myapp/bin:$PATH"`—and place modular scripts in /etc/profile.d with executable permission to keep configuration maintainable. Complementary tools Use /etc/profile.d for split configuration, check per-user files like ~/.bashrc or ~/.profile for overrides, consider PAM's pam_env or systemd user environment for service contexts, and use `env` or `printenv` to debug what actually lands in a session. Final push Mastering /etc/profile is a small, powerful step toward robust Linux administration; keep experimenting, test across login methods, and consider formalizing skills with certifications like CompTIA Linux+ or LPIC-1 and intensive exam preparation at bitsandbytes.academy. Join Bits & Bytes Academy First class LINUX exam preparation. setup scripting boot-process troubleshooting