How do I permanently change the PATH in Linux?

Another n00b Linux question: how do I make a permanent change to the PATH in Linux?

I can do the PATH=<change>:$PATH bit just fine, but it only lasts as long as that terminal session. SETENV apparently is not a valid Bash command. There has to be a startup file somewhere that holds the environment data, but I’m clueless where to find it. Help, please…

In your /home/username/ directory, look for ‘.bashrc’ or ‘.bash_profile’ - note the dot in front of each name, which means a normal “ls” won’t show them, you’ll have to do “ls -a”. They each get run whenever you login, so add your “PATH=$PATH:/added_path” command there.

Thanks.

Note that this only changes things for scripts you run under your normal login ID. If you want scripts run under other login IDs (such as root) to see the changed path, put the line in /etc/profile. You will need to use sudo to edit the file.

Never do normal stuff logged in as root. In fact, never log in as root at all. Log in as a normal user and use sudo to do stuff only root can do.

You may want to export that as well. export makes sure it’s set in inherited envs. With bash you can do
export PATH=/new/path:${PATH}

or put them on separate lines
PATH=/new/path:${PATH}
export PATH