Linux Env and PATH

Environment variables, PATH order, and persistent shell config.

  • linux PATH
  • export env
  • bashrc profile
  • environment variable
  • source config

Linux Env and PATH

Environment variables, PATH order, and persistent shell config.

Commands

CommandWhat it does
`printenvsort`All exported variables
echo PATH tr colonOne directory per line
export PATH-priorityPrepend your bin dir
source bashrcReload shell config
env -i minimal runClean-room command test

Example

export PATH="$HOME/.local/bin:$PATH"
echo "$PATH" | tr ':' '\n' | head

FAQ

Changes vanish after logout - why?

export in the shell lasts for that session only; persist in profile or bashrc files.

Which file loads when?

Login shells read profile, interactive non-login shells read bashrc - put PATH in both or source one from the other.

الأسئلة الشائعة

Changes vanish after logout - why?
export in the shell lasts for that session only; persist in profile or bashrc files.
Which file loads when?
Login shells read profile, interactive non-login shells read bashrc - put PATH in both or source one from the other.

Linux