← Knowledge Base
LinuxReference note1 min read · updated 2026-11-27

Environment variables and PATH

View, set and persist environment variables, and fix "command not found" caused by PATH.

envpathshell
printenv                       # all variables
echo "$PATH"
export EDITOR=nano             # for this shell and its children
VAR=1 command                  # for one command only
type -a python3                # which executable is found first
which -a python3

Persist for your user in ~/.profile (login shells) or ~/.bashrc (interactive shells): export PATH="$HOME/.local/bin:$PATH". System-wide variables go in /etc/environment (plain KEY=value). A service started by systemd does not read your .bashrc; use Environment= or EnvironmentFile= in its unit. Keep secrets out of the global environment.