Java users know pretty much about what $PATH is and how to add a path variable in your machine. 🙂
$PATH it is a variable added in your system. This variable keeps the information of paths. What kind of path? PATH is also known as a system variable. It let’s the system know about software applications installed in your operating system. System should know every executable paths of your operating system(path of .exe in your Windows or /bin in Linux).
So here is how we add $PATH in our Linux System. I am using Ubuntu and I will be adding a $PATH for running composer.
$PATH for using Composer from Linux Terminal
Adding $PATH is an easy task. There are basically two ways to add the path variable. My example will be adding composer’s executable path in system variable i.e. $PATH
- FIRST: You can add your path in a file names .bashrc. .bashrc is located at your home folder.
PATH=”$PATH:$HOME/.config/composer/vendor/bin” - SECOND: From your linux terminal you can use export command which will add your path to the system.
export PATH=”$PATH:$HOME/.config/composer/vendor/bin”
In case you chose the first option. You need to run one more command from your terminal: source ~/.bashrc . This will compile the .bashrc file and set all the variables and commands for you.
If something goes wrong, check how to reset your .bashrc file with the help of this post: Messed Up Your .bashrc file? How To Fix your Linux Desktop?[Fix]