How to Set the PATH Variable in Linux
-
by cobra_admin
- 37
In Linux, your PATH is a list of directories that the shell will look in for executable files when you issue a command without a path. The PATH variable is usually populated with some default directories, but you can set the PATH variable to anything you like.
WHEN A COMMAND NAME IS SPECIFIED BY THE USER OR AN EXEC CALL IS MADE FROM A PROGRAM, THE SYSTEM SEARCHES THROUGH
$PATH
, EXAMINING EACH DIRECTORY FROM LEFT TO RIGHT IN THE LIST, LOOKING FOR A FILENAME 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. -Wikipedia
In this short tutorial, we will discuss how to add a directory to your PATH and how to make the changes permanent. Although there is no native way to delete a default directory from your path, we will discuss a workaround. We will end by creating a short script and placing it in our newly created PATH to demonstrate the benefits of the PATH variable.
Read more at Putorius
In Linux, your PATH is a list of directories that the shell will look in for executable files when you issue a command without a path. The PATH variable is usually populated with some default directories, but you can set the PATH variable to anything you like. WHEN A COMMAND…
In Linux, your PATH is a list of directories that the shell will look in for executable files when you issue a command without a path. The PATH variable is usually populated with some default directories, but you can set the PATH variable to anything you like. WHEN A COMMAND…