Working Directory

In computing, the working directory of a process is a directory of a hierarchical file system, if any, dynamically associated with each process. When the process refers to a file using a simple file name or relative path (as opposed to a file designated by a full path from a root directory), the reference is interpreted relative to the current working directory of the process. So for example a process with working directory /rabbit-hats that asks to create the file foo.txt will end up creating the file /rabbit-hats/foo.txt.

In most computer file systems, every directory has an entry (usually named ".") which points to the directory itself.

In most DOS and UNIX command shells, as well as in the Microsoft Windows command line interpreters cmd.exe and Windows PowerShell, the working directory can be changed by using the cd or chdir commands. In Unix shells, the pwd command outputs the absolute pathname of the current working directory; the equivalent command in DOS and Windows is cd without arguments (whereas in Unix, cd used without arguments takes the user back to his/her home directory). The environment variable PWD (in Unix/Linux shells) or CD (in DOS/Windows shells) is also set for use in scripts, so that one need not start an external program. The POSIX function chdir, where available, can be called by a process to set its working directory.

Famous quotes containing the words working and/or directory:

    [My father] was a lazy man. It was the days of independent incomes, and if you had an independent income you didn’t work. You weren’t expected to. I strongly suspect that my father would not have been particularly good at working anyway. He left our house in Torquay every morning and went to his club. He returned, in a cab, for lunch, and in the afternoon went back to the club, played whist all afternoon, and returned to the house in time to dress for dinner.
    Agatha Christie (1891–1976)

    Although then a printer by trade, he listed himself in this early directory as an antiquarian. When he was asked the reason for this he replied that he always thought every town should have at least one antiquarian, and since none appeared for the post, he volunteered.
    —For the State of Iowa, U.S. public relief program (1935-1943)