1. Using Linux PATH variable

Linux path environmental variable contains a list of directories in which the shell looks for executable programs every time you run a command or program. Use echo command to print your PATH variable:

$ echo $PATH

If the program / command is located within my PATH user do not need to include full path in order to execute a certain command. For example: date command is located within /bin:

$ which date

and /bin is defined in my PATH variable. Therefore, to execute date command is easy as:

$ date

2. Adding a new directory into PATH variable

From time to time you may need to add new directory into your PATH scope. The following example adds new directory /bin/myscripts into PATH variable:

$ echo $PATH
$ PATH=$PATH:/bin/myscripts
$ export PATH
$ echo $PATH

Free Linux eBooks

Go to top