March 21, 2019

How to Set the PATH Variable in Linux

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

Click Here!