Here is the video version, if you prefer it:
If you want to make permanent changes to your environment, here is how to do it:
In virtually all use cases, you should modify
.bashrc file located in your home directory (i.e.
/home/mislav/.bashrc). The reason for that is that both login shells and interactive non-login shells read these files explicitly (and execute the commands within them). (“Why is /etc/profile not invoked for non-login shells?,” n.d.)
Here are some lines I have added (appended) to my
.bashrc file (in
# added for Python
# added for Java
These are the lines I added. They add certain directories to my
PATH variable. The general syntax for adding to my
PATH variable is:
newPath is a path (or multiple paths delimited by a colon) where I want to look for executables. The
$PATH get substituted for the contents of the variable
When writing this article, I found myself Googling quite a lot to make sure I really understood what files were read by what kinds of shells. A really great read on this is found here: (“Why is /etc/profile not invoked for non-login shells?,” n.d.). The main thing I got from the aforementioned reference is to place all of my changes in
.bashrc, but it is such a great answer that I would urge you to read it if you have the time.
Hope you learned something useful!
Why is /etc/profile not invoked for non-login shells? (n.d.). Retrieved February 7, 2020, from https://askubuntu.com/questions/247738/why-is-etc-profile-not-invoked-for-non-login-shells