Contents[Hide]

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
/home/lilo/bin:/usr/local/bin:/usr/bin:/bin:/usr/games

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
/bin/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
/home/lilo/bin:/usr/local/bin:/usr/bin:/bin:/usr/games
$ PATH=$PATH:/bin/myscripts
$ export PATH
$ echo $PATH
/home/lilo/bin:/usr/local/bin:/usr/bin:/bin:/usr/games:/bin/myscripts


Free Linux eBooks

Do you have the right skills?

Our IT Skills Watch page reflects an up to date IT skills demand leaning towards the Linux and Unix environment. We have considered a number of skills and operating systems.

See the result...

Linux Online Training

Learn to run Linux servers and prepare for LPI certification with Linux Academy. 104 available video lessons with PDF course notes with your own server!

Go to top