PATH is an environment variable on Unix-like operating systems, DOS, OS/2, and Microsoft Windows, specifying a set of directories where executable programs are located. In general, each executing process or user session has its own PATH setting.
Multics originated the idea of a search path. The early Unix shell only looked for program names in /bin
, but by Version 3 Unix the directory was too large and /usr/bin
, and a search path, became part of the operating system.
On POSIX and Unix-like operating systems, the $PATH
variable is specified as a list of one or more directory names separated by colon (:
) characters.
The /bin
, /usr/bin
, and /usr/local/bin
directories are typically included in most users' $PATH
setting (although this varies from implementation to implementation). The superuser also typically has /sbin
and /usr/sbin
entries for easily executing system administration commands. The current directory (.
) is sometimes included by users as well, allowing programs residing in the current working directory to be executed directly. Superuser (root) accounts as a rule do not include it in $PATH
, however, in order to prevent the accidental execution of scripts residing in the current directory, such as may be placed there by a malicious tarbomb. In that case, executing such a program requires specifying an absolute (/home/userjoe/bin/script.sh
) or relative path (./script.sh
) on the command line.