What Is the PATH Environment Variable?

PATH is an environment variable listing directories the shell searches, in order, when you type a command name without specifying its full path.

Published November 22, 2026

PATH is an environment variable holding a list of directories the shell searches, in order, for a program when you type its name. If a command is not found, its folder is probably missing from PATH.

The concept

Directories are separated by colons (Linux/macOS) or semicolons (Windows). The first match wins, so order matters.

Installers add folders to PATH; you can change it per session or permanently in your shell profile (~/.bashrc, ~/.zshrc).

Search order

echo $PATH
/home/ada/bin:/usr/local/bin:/usr/bin:/bin
which node
/usr/local/bin/node (first match)

Practical examples

Add a folder for this session

export PATH="$HOME/bin:$PATH"

Make it permanent

echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.zshrc
source ~/.zshrc

Find where a command lives

which python3
type -a python3

Windows

$env:Path += ';C:\tools'
setx PATH "$env:Path;C:\tools"

Common mistakes

  • Overwriting PATH instead of appending (export PATH=/new).
  • Putting . (current directory) in PATH, a security risk.
  • Editing the wrong profile file.

Key takeaways

  • List of directories searched for commands.
  • Order matters.
  • Persist changes in your shell profile.

FAQ

Why 'command not found'?

The program is not installed or its folder is not in PATH.

How do I see PATH entries one per line?

echo $PATH | tr ':' '\n'

More Linux articles