Unix: Getting Export PATH to "Stick"

export, path, shell, terminal, unix

Solution

Open `~/.bashrc.` This file is loaded every time you start up a new shell (if you're using Bash, which most people are). If you're using a different shell, the file may have a different name, like `~/.shrc`.

Add the line you need to the bottom of the file:

export PATH=$PATH:$EC2_HOME/bi

Other info rolled up from elsewhere in the thread:

There are multiple places to put this, depending on your shell and your needs. All of these files are in your home directory:

For Bash:

.bashrc (executed when you shart a shell)

OR

.bash_profile (executed when you log in)

For csh and tcsh:

.cshrc

For sh and ksh:

.profile

Problem

When setting the export path in Unix, example: ``` export PATH=$PATH: $EC2_HOME/bin ``` If I quit terminal and open it back up to continue working, I have to go through all the steps again, setting up the paths each time. I'm wondering how I can set the path and have it "stick" so my system knows where to find everything the next time I open terminal without having to do it all over again. Thanks!

Original source