The PATH Variable Explained — Add a Tools Folder on Linux
What PATH is, why the shell searches it in order, and the safe way to prepend your own bin directory so personal scripts run from anywhere.
01Command
$ echo $PATH && export PATH="$HOME/.local/bin:$PATH"02What it does
PATH is a colon-separated list of directories the shell searches, left to right, whenever you type a command name; the first match wins, which is why 'command not found' simply means no listed directory contains that name. Prepending your own directory ($HOME/.local/bin:$PATH) makes your scripts take precedence over system tools, while appending (:...$PATH) gives them the lowest priority — a crucial distinction when shadowing commands like python. Put the export in ~/.bashrc (or ~/.zshrc) so every new terminal inherits it, and confirm the result with echo $PATH and command -v yourscript.
03Risk
04Undo
$ Remove the export PATH line from ~/.bashrc / ~/.zshrc and reopen the terminal05Sources
- which(1) — Linux manual pageEvidence: which resolves command names against PATH, demonstrating the directory search order the shell uses.
- bash(1) — Linux manual pageEvidence: Documents PATH: a colon-separated list of directories searched in order for command execution; empty entries mean the current directory.
Last verified: 2026-09-18 · Category: Developer