Skip to content

Instantly share code, notes, and snippets.

@ArthurDelannoyazerty
Created July 8, 2025 09:46
Show Gist options
  • Save ArthurDelannoyazerty/5e11f4672b0dd39a57fedfb394045577 to your computer and use it in GitHub Desktop.
Save ArthurDelannoyazerty/5e11f4672b0dd39a57fedfb394045577 to your computer and use it in GitHub Desktop.

List env variables

env
printenv

Shell variable VS Environment variable

Shell

Variables only accessible by the shell, not the subprocess

VAR=123
VAR=azerty
echo $VAR

Environment

Variables accessible by the subprocess

export VAR=123
export VAR=azerty
echo $VAR

Standard variables

  • $PATH : List of directories (separated by :) that tells the shell where to look to find exectable command
  • $HOME : Same as ~ (because ~ expand to $HOME)
  • $USER : Username
  • $SHELL : Path to the shell executable
  • $PWD : Current directory (same as pwd command)
  • $LANG : Locale settings (ex: en_US.UTF-8)
  • $TERM : Name of the shell (ex: xterm for MobaXterm)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment