Clever Geek Handbook
📜 ⬆️ ⬇️

PATH (variable)

PATH is an environment variable for Unix-like operating systems , DOS , OS / 2 and Microsoft Windows , which is a set of directories in which executable files are located. Basically, each running process or user session has its own PATH variable.

Unix and Unix-like

On POSIX and Unix-like operating systems, the $PATH variable is specified as one or more directory names separated by colons ( : . [1] [2]

Basically, the $PATH variable includes the directories /bin , /usr/bin and /usr/local/bin . Often, the current directory ( . ) Is also included, which allows programs to be executed directly from it. However, administrators generally do not include it in the $PATH variable to avoid accidentally executing scripts from the current directory. Running such a program requires writing ( ./ ) before the name.

After creating a start request by a user or program, the system will check each directory of the $PATH variable from left to right in search of a file matching the given command. The first program found is executed as a child of the shell or the program that made the request.

DOS, OS / 2, and Windows

On DOS, OS / 2, and Windows operating systems, the %PATH% variable is set as a list of directories separated by a semicolon ( ; ). [3]

The Windows system directory (usually C:\WINDOWS\system32 ) is usually the first directory on the list, followed by many (not all) directories with installed programs. Many programs do not fall into PATH , because they are not designed to run from the shell , only from the GUI . Some programs may add their directories at the beginning of the PATH variable during the installation process to speed up the process of searching and / or replacing OS commands. In the DOS era, the PATH {program directory};%PATH% lines PATH {program directory};%PATH% or SET PATH={program directory};%PATH% could be manually added to the AUTOEXEC.BAT file.

After entering a command or executing a system call, the system first looks in the current directory , and then in the PATH variable, checking each directory from left to right for the presence of an executable file corresponding to this command. Executable programs can have the extensions .exe , .com , .bat , .cmd , and also added by the user.

Upon finding the executable file, the system launches it.

The PATH variable makes it easy to run public utilities located in separate directories. However, the illiterate use of the PATH variable can slow down the operating system as a result of searching among a large number or among non-existent directories.

Links

  1. ↑ Open Group Unix Specification, Environment Variables
  2. ↑ Open Group Unix Specification, execve () function
  3. ↑ Microsoft.com, PATH command
Source - https://ru.wikipedia.org/w/index.php?title=PATH_(variable)&oldid=100408551


More articles:

  • Castillo, Fabian
  • Garriot (Moon Crater)
  • Bukovina Shepherd Dog
  • Obukhov, Valery Leonidovich
  • Panama Myrikina
  • 1908 World Weightlifting Championships
  • Batko, Carlo
  • World Weightlifting Championship 1911 (IV)
  • Lucius Marcius Tsensorin (consul 149 BC)
  • Tosa-class battleships

All articles

Clever Geek | 2019