The PATH variable is an environment variable containing an ordered list of directories. When you type a command such as python without a full path, the shell checks each directory in PATH, left to right, and runs the first matching executable. Entries are separated by : on Linux and macOS, and ; on Windows.
Why it matters
A "command not found" or "is not recognized as an internal or external command" error often means the program's folder is not in PATH. Adding the right directory lets you run tools from anywhere, while a wrong order can run an unexpected version of a program.
Example
$ echo $PATH
/usr/local/bin:/usr/bin:/bin
$ export PATH="$HOME/tools:$PATH"
The second line puts ~/tools first. To make it permanent, add it to ~/.bashrc or ~/.zshrc. On Windows, edit it under System Properties, Environment Variables, then restart the terminal.
Common mistakes
- Overwriting PATH with
export PATH=/new/dirand losing all existing entries. - Not reopening the terminal after changing it, so the old value remains.
- Putting a writable or untrusted folder early in PATH, which lets a rogue program impersonate a trusted command.
Related
Get notified when this term updates
Plus occasional practical tips on uptime and monitoring, nothing else. Unsubscribe anytime.
This page is general information written by our editorial team and updated when documentation changes. Servers and providers differ, so test changes safely first. See our editorial policy and disclaimer.