Setting PATH in Linux: Main problem we deal with

Setting PATH in Linux: Main problem we deal with

·

0 min read

Important skill for Linux users

Setting path on Linux is important when you want to use executable files in the directories. There is always a problem whether to set the variable temporarily or permanently.

cover.png

Before exploring what the problem we face when we deal with path on Linux , we should have a little summary about $PATH.

Defining PATH

PATH is an environment variable in Unix like Operating systems and Microsoft windows that tells the shell which directories to search for executable files. Unix shell is our choice for this article.

Setting PATH

one must consider different conditions to set PATH which are setting the PATH permanently, temporarily, for single user or all users.

There are important files we need to know about when setting a PATH…

Files we need

1.png

Test your path list using this command …

 $export $PATH

Be ready for problems

1*L0cmH9-ricnybugG8FBFRQ.gif

Mostly annoying Error message we get from setting path variable wrong is Command not Found.

COMPUTER_NAME:~$ Python 
python:command not found

Getting this error message and wasting my precious time looking for an answer through searching the internet is a motivation of this article. I am going to save you time and get the answer here in one.

If what you are looking for is setting the path temporarily ( when you want to use the file service until the computer shuts down )

COMPUTER_NAME:~$ export PATH = "$PATH:path_of_the_file"

In other world, if your need is to use the file permanently modify /etc/environment and add the path_of_the_file ) at the end of the PATH line inside the quote. we also must have to alter ~/.bashrc file and add export PATH = “$PATH:path_of_the_file” at the end of the file.

In /etc/profile you can set path for all user by adding the common export line ( export PATH = “$PATH:path_of_the_file” ) at the end of the file. Last one we are going to alter and add the export line at the end of this file line is .bash_profile which we use to configure the user environments.

If all this applied when we want to use any executable file on our computer there won’t be any problem.

I hope you find something useful here to solve this annoying problem that have been bothering me for quite some time now and speed up your work.