How to permanently set $PATH on Linux/Unix



How to permanently set $PATH on Linux/Unix

How to permanently set $PATH on Linux/Unix

Learn how to permanently set $PATH on Linux/Unix.

You can set the PATH environment variable, using the following command.

export PATH=$PATH:/path/to/my/binary/file/

However, each time you exit the terminal or SSH session, and start a new terminal session, this PATH is lost. You have to run the same command again to recover the path. How can you permanently set this path?

Here are the step on how to resolve it.
1) cd ~
2) sudo nano .bashrc
3) Add the following line at the very bottom of file .bashrc.
export PATH=$PATH:/usr/local/go/bin
4) Save the .bashrc and exit.
5) ctrl + D to exit the terminal
6) Log back again.

#linux #ubuntu #path