How to Set a Path in Linux

In this tutorial we will show you how to set a path in Linux.
It is an environment variable through which you can specify the directory in which program files are located.
Setting the path in Linux is not a tedious task and can be done in a short span of time.



Step 1 – Select the Home Folder icon
First of all, in the launcher click on the Home Folder icon.
With that done, here you will see two directories are placed here, namely dir1 and dir2.
Click on the Home Folder icon

Step 2 – Enter command in terminal application
Now we are going to set dir1 as a path, and for that we will open up the terminal application by pressing ctrl+alt+T.
With the terminal application opened up, type
“export PATH=$PATH:/dir1” and hit enter.
This will export the dir1 address to the hidden directory that is, $PATH. This way you can easily set a path in Linux.
Insert command in terminal application

Step 3 – View the path
If you want to view where the path is set, type the command echo $PATH and hit enter.
This will show you the exact directory path.
And that’s it, by following the steps above you will learn that setting a path in Linux can be done easily.
Locate the path