Knowledge (XXG)

PATH (variable)

Source 📝

25: 410:
The PATH variable makes it easy to run commonly used programs located in their own folders. If used unwisely, however, the value of the PATH variable can slow down the operating system by searching too many locations, or invalid locations.
323:) 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 331:. Some programs may add their directory to the front of the PATH variable's content during installation, to speed up the search process and/or override OS commands. In the DOS era, it was customary to add a 479: 418:
services from running altogether, especially the 'Server' service which is usually a dependency for other services within a Windows Server environment.
364:
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
267:
in order to prevent the accidental execution of scripts residing in the current directory, such as may be placed there by a malicious
108: 42: 513: 508: 46: 89: 61: 68: 457: 35: 365: 256: 148: 75: 283: 57: 248: 468: 125: 152: 373: 404: 144: 132: 82: 396: 490: 368:
and then searches the path, examining each directory from left to right, looking for an
312:
variable is specified as a list of one or more directory names separated by semicolon (
179: 502: 324: 295: 156: 435: 358: 212:-string are not meant to be escaped, making it impossible to have directories with 204:
variable is specified as a list of one or more directory names separated by colon (
441:
A Research Unix reader: annotated excerpts from the Programmer's Manual, 1971–1986
400:. Other executable filename extensions can be registered with the system as well. 24: 439: 390: 369: 171: 255:) is sometimes included by users as well, allowing programs residing in the 236: 129: 271:. In that case, executing such a program requires specifying an absolute ( 235:
setting (although this varies from implementation to implementation). The
384: 291: 290:, examining each directory from left to right in the list, looking for a 294:
that matches the command name. Once found, the program is executed as a
372:
filename that matches the command name given. Executable programs have
268: 167: 480:
Dash exec.c as an example of an implementation of a PATH-string parser
195: 151:
where executable programs are located. In general, each executing
140: 378: 328: 136: 18: 259:
to be executed directly. System administrators as a rule do
186:, and a search path, became part of the operating system. 298:
of the command shell or program that issued the command.
286:
call is made from a program, the system searches through
403:
Once a matching executable file is found, the system
458:
Open Group Unix Specification, Environment Variables
342: 332: 282:When a command name is specified by the user or an 49:. Unsourced material may be challenged and removed. 231:directories are typically included in most users' 306:On DOS, OS/2, and Windows operating systems, the 469:Open Group Unix Specification, execve() function 170:originated the idea of a search path. The early 8: 447:(Technical report). CSTR. Bell Labs. 139. 109:Learn how and when to remove this message 319:The Windows system directory (typically 427: 388:, and batch scripts have extensions of 198:and Unix-like operating systems, the 7: 47:adding citations to reliable sources 14: 251:commands. The current directory ( 208:) characters. Directories in the 174:only looked for program names in 182:the directory was too large and 23: 34:needs additional citations for 1: 247:entries for easily executing 16:Computer environment variable 407:a new process that runs it. 491:Microsoft.com, PATH command 414:Invalid locations can also 273:/home/userjoe/bin/script.sh 530: 159:has its own PATH setting. 366:current working directory 257:current working directory 329:Graphical User Interface 279:) on the command line. 302:DOS, OS/2, and Windows 147:, specifying a set of 514:Environment variables 509:Computer file systems 249:system administration 352:{program directory}; 336:{program directory}; 327:, but rather from a 275:) or relative path ( 126:environment variable 58:"PATH" variable 43:improve this article 374:filename extensions 321:C:\WINDOWS\system32 239:also typically has 190:Unix and Unix-like 145:Microsoft Windows 133:operating systems 119: 118: 111: 93: 521: 493: 488: 482: 477: 471: 466: 460: 455: 449: 448: 446: 432: 399: 393: 387: 381: 356: 355: 351: 348: 345: 340: 339: 335: 322: 315: 310: 289: 278: 274: 266: 254: 246: 242: 234: 230: 226: 222: 215: 211: 207: 202: 185: 177: 114: 107: 103: 100: 94: 92: 51: 27: 19: 529: 528: 524: 523: 522: 520: 519: 518: 499: 498: 497: 496: 489: 485: 478: 474: 467: 463: 456: 452: 444: 434: 433: 429: 424: 395: 389: 383: 377: 353: 349: 346: 343: 337: 333: 320: 313: 308: 304: 287: 276: 272: 264: 252: 244: 240: 232: 228: 224: 220: 216:in their name. 213: 209: 205: 200: 192: 183: 175: 165: 115: 104: 98: 95: 52: 50: 40: 28: 17: 12: 11: 5: 527: 525: 517: 516: 511: 501: 500: 495: 494: 483: 472: 461: 450: 436:McIlroy, M. D. 426: 425: 423: 420: 325:command window 316:) characters. 303: 300: 263:include it in 229:/usr/local/bin 191: 188: 180:Version 3 Unix 164: 161: 117: 116: 31: 29: 22: 15: 13: 10: 9: 6: 4: 3: 2: 526: 515: 512: 510: 507: 506: 504: 492: 487: 484: 481: 476: 473: 470: 465: 462: 459: 454: 451: 443: 442: 437: 431: 428: 421: 419: 417: 412: 408: 406: 401: 398: 392: 386: 380: 375: 371: 367: 362: 360: 330: 326: 317: 311: 301: 299: 297: 296:child process 293: 285: 280: 270: 262: 258: 250: 238: 217: 203: 197: 189: 187: 181: 173: 169: 162: 160: 158: 154: 150: 146: 142: 138: 134: 131: 127: 123: 113: 110: 102: 91: 88: 84: 81: 77: 74: 70: 67: 63: 60: –  59: 55: 54:Find sources: 48: 44: 38: 37: 32:This article 30: 26: 21: 20: 486: 475: 464: 453: 440: 430: 415: 413: 409: 402: 363: 359:AUTOEXEC.BAT 318: 307: 305: 281: 260: 218: 199: 193: 166: 157:user session 121: 120: 105: 96: 86: 79: 72: 65: 53: 41:Please help 36:verification 33: 277:./script.sh 149:directories 99:August 2014 503:Categories 422:References 370:executable 172:Unix shell 69:newspapers 245:/usr/sbin 237:superuser 178:, but by 130:Unix-like 438:(1987). 357:line to 292:filename 225:/usr/bin 184:/usr/bin 269:tarbomb 168:Multics 163:History 153:process 83:scholar 405:spawns 354:%PATH% 338:%PATH% 309:%PATH% 288:$ PATH 265:$ PATH 233:$ PATH 227:, and 201:$ PATH 143:, and 124:is an 85:  78:  71:  64:  56:  445:(PDF) 241:/sbin 196:POSIX 90:JSTOR 76:books 416:stop 347:PATH 334:PATH 284:exec 243:and 221:/bin 219:The 210:PATH 176:/bin 141:OS/2 122:PATH 62:news 397:CMD 394:or 391:BAT 385:COM 382:or 379:EXE 376:of 344:SET 341:or 261:not 194:On 155:or 137:DOS 128:on 45:by 505:: 361:. 223:, 139:, 135:, 350:= 314:; 253:. 214:: 206:: 112:) 106:( 101:) 97:( 87:· 80:· 73:· 66:· 39:.

Index


verification
improve this article
adding citations to reliable sources
"PATH" variable
news
newspapers
books
scholar
JSTOR
Learn how and when to remove this message
environment variable
Unix-like
operating systems
DOS
OS/2
Microsoft Windows
directories
process
user session
Multics
Unix shell
Version 3 Unix
POSIX
superuser
system administration
current working directory
tarbomb
exec
filename

Text is available under the Creative Commons Attribution-ShareAlike License. Additional terms may apply.