Categories
Linux Tutorial Series

Linux Tutorial Series – 83 – Modifying environment variables

Here is the video version, if you prefer it:

If you ever want to modify environment variables (and you may sometimes) or some tutorial you find on the World Wide Web advises you to do so, it is useful to know what is going on.

When modifying environment variables, you are, in most cases, adding something to already existing environment variables. Here is how to do it: (modeled after (Ward, 2014)⁠)

mislav@mislavovo-racunalo:~$ printenv | grep VARIABLE

mislav@mislavovo-racunalo:~$ VARIABLE=value

mislav@mislavovo-racunalo:~$ export VARIABLE

mislav@mislavovo-racunalo:~$ printenv | grep VARIABLE

VARIABLE=value

The commands we are focusing on here are VARIABLE=value and export VARIABLE. Those commands introduce a new variable named VARIABLE with the value value and export VARIABLE places variable VARIABLE in the environment.

The changes you just made to your environment are non-permanent. Meaning, when you close your Terminal window, the variable VARIABLE will disappear from the environment. There is a way to make these changes permanent, but it is a topic for another post.

Hope you learned something useful!

References

Ward, B. (2014). How Linux Works: What Every Superuser Should Know (2nd ed.). No Starch Press. Pages 21-22

NewsletterUpdates on interesting things I am doing

Subscribe to my newsletter to keep abreast of the interesting things I'm doing. I will send you the newsletter only when there is something interesting. This means 0% spam, 100% interesting content.

Leave a Reply

Your email address will not be published. Required fields are marked *