How to Permanently Add PATH Variable on Ubuntu

I was installing SQLPlus Utility on my Ubuntu 18.04. The sqlplus command is saved in my Oracle instant client directory. So, everytime I want to execute the command, I have to include the full path of this file. There is an easy way to do this. By exporting the directory to the PATH variable, we can directly call the command.

Command to export directory to PATH example.

export PATH=/opt/oracle/instantclient_12_2:$PATH

And then I can execute the program inside the instantclient_12_2 directly. But, after system restart or I close the terminal, I need to execute the export command again. To fix this, we need to permanently add the directory to PATH variable. To do this, simply open the profile file under your home directory.

nano ~/.profile

And then add the directory to the end of the file

export PATH="/opt/oracle/instantclient_12_2"

Close the file and then execute this command

source ~/.profile

Done.

Be the first to comment

Leave a Reply