Search Path for Commands

$PATH defines where the shell searches for commands. Separate entries with colons :. Entries are searched left to right.

When you invoke a command just by name, e.g. man instead of /usr/bin/man, then the executable file is searched in $PATH.

Examples

Current Directory
Lookup commands in the current directory first
1
export PATH=".:$PATH"
Multiple Directories
Lookup commands first in /usr/local/bin, then in the previously declared directories:
1
export PATH="/usr/local/bin:$PATH"
BashSupport Pro is a Bash IDE with support for $PATH – try it now!
© 2020–2022 Joachim Ansorg
Imprint
Privacy Policy
Legal