Path (variable)
Encyclopedia
PATH is an environment variable
Environment variable
Environment variables are a set of dynamic named values that can affect the way running processes will behave on a computer.They can be said in some sense to create the operating environment in which a process runs...

 on Unix-like
Unix-like
A Unix-like operating system is one that behaves in a manner similar to a Unix system, while not necessarily conforming to or being certified to any version of the Single UNIX Specification....

 operating system
Operating system
An operating system is a set of programs that manage computer hardware resources and provide common services for application software. The operating system is the most important type of system software in a computer system...

s, DOS
DOS
DOS, short for "Disk Operating System", is an acronym for several closely related operating systems that dominated the IBM PC compatible market between 1981 and 1995, or until about 2000 if one includes the partially DOS-based Microsoft Windows versions 95, 98, and Millennium Edition.Related...

, OS/2
OS/2
OS/2 is a computer operating system, initially created by Microsoft and IBM, then later developed by IBM exclusively. The name stands for "Operating System/2," because it was introduced as part of the same generation change release as IBM's "Personal System/2 " line of second-generation personal...

, and Microsoft Windows
Microsoft Windows
Microsoft Windows is a series of operating systems produced by Microsoft.Microsoft introduced an operating environment named Windows on November 20, 1985 as an add-on to MS-DOS in response to the growing interest in graphical user interfaces . Microsoft Windows came to dominate the world's personal...

, specifying a set of directories
Directory (file systems)
In computing, a folder, directory, catalog, or drawer, is a virtual container originally derived from an earlier Object-oriented programming concept by the same name within a digital file system, in which groups of computer files and other folders can be kept and organized.A typical file system may...

 where executable programs are located. In general, each executing process
Process (computing)
In computing, a process is an instance of a computer program that is being executed. It contains the program code and its current activity. Depending on the operating system , a process may be made up of multiple threads of execution that execute instructions concurrently.A computer program is a...

 or user session
Login session
In computing, a login session is the period of activity between a user logging in and logging out of a system.On Unix and Unix-like operating systems, a login session takes one of two main forms:...

 has its own PATH setting.

Unix and Unix-like

On POSIX
POSIX
POSIX , an acronym for "Portable Operating System Interface", is a family of standards specified by the IEEE for maintaining compatibility between operating systems...

 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 current directory (.) is sometimes included 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 the path, however, in order to prevent the accidental execution of scripts residing in the current directory. Executing such a program requires the deliberate use of a directory prefix (./) on the command name.

When a command name is specified by the user or an exec
Exec (operating system)
The exec collection of functions of Unix-like operating systems cause the running process to be completely replaced by the program passed as an argument to the function...

 call is made from a program, the system searches the path, examining each directory from left to right in the list, looking for a filename
Filename
The filename is metadata about a file; a string used to uniquely identify a file stored on the file system. Different file systems impose different restrictions on length and allowed characters on filenames.A filename includes one or more of these components:...

 that matches the command name. Once found, the program is executed as a child process of the command shell or program that issued the command.

DOS, OS/2, and Windows

On DOS, OS/2, and Windows operating systems, the %PATH% variable is specified as a list of one or more directory names separated by semicolon (;) characters.

The Windows system directory (typically C:\WINDOWS\system32) is typically the first directory in the path, followed by many (but not all) of the directories for installed software packages. Many programs do not appear in the path as they are not designed to be executed from a command window, but rather from a Graphical User Interface
Gui
Gui or guee is a generic term to refer to grilled dishes in Korean cuisine. These most commonly have meat or fish as their primary ingredient, but may in some cases also comprise grilled vegetables or other vegetarian ingredients. The term derives from the verb, "gupda" in Korean, which literally...

.

When a command is entered in a command shell or a system call is made by a program to execute a program, the system first searches the current working directory and then searches the path, examining each directory from left to right, looking for an executable
Executable
In computing, an executable file causes a computer "to perform indicated tasks according to encoded instructions," as opposed to a data file that must be parsed by a program to be meaningful. These instructions are traditionally machine code instructions for a physical CPU...

 filename that matches the command name given. Executable programs have filename extension
Filename extension
A filename extension is a suffix to the name of a computer file applied to indicate the encoding of its contents or usage....

s of EXE or COM, and batch scripts have extensions of BAT or CMD. Other executable filename extensions can be registered with the system as well.

Once a matching executable file is found, the system spawns
Spawn (computing)
Spawn in computing refers to a function that loads and executes a new child process.The current process may or may not continue to execute asynchronously...

a new process in which to run it.
The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK