Environment variables are of great importance when you are building software applications based on the Ubuntu Operating system. They are used to store details about the environment in which the program or a script runs.
Types of Environment Variables:
- System-Wide Environment Variables: These environment variables apply to the entire operating system and affect all users.
- User-Specific Environment Variables: These environment variables are specific to individual user accounts and not the whole system.
- Temporary Environment Variables: These are only in effect for the duration of the current session, once the session is closed or the Terminal is exited, these settings will be lost.
- Permanent Environment Variables: These environment variables persist across sessions and reboots, even when the session is closed or the Terminal is exited, these settings will not be lost..
Examples of Setting Environment Variables
- System-Wide Temporary Environment Variables: We make use of the export command to set temporary variables.
Example:export DEV_SERVER_URL="https://192.167.8.2:8000"
- System-Wide Permanent Environment Variables: We will to add the environemnt avriable to /etc/environment file to make it parmanent.
Example:nano /etc/environment
Add the environment variable and save and exit.
JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64
- User-Specific Temporary Variable: We make use the export command.
Example:export EDITOR=nano
- User-Specific Permanent Variable: We add to the PATH variable under ~/.bashrc or ~/.zshrc
Example:export PATH="$PATH:/home/user/bin"

-
Facing issues? Have Questions? Post them here! I am happy to answer!
More Posts related to Ubuntu,
- Install Oh My Zsh on Ubuntu Docker complete steps
- Installing Home-brew on Ubuntu
- Install Golang (Go) on Ubuntu
- Install specific JRE on Ubuntu using apt
- How to stop/start/restart apache server using command [Ubuntu]
- How to install zsh shell on Ubuntu
- Quick steps to install Nginx on Ubuntu Linux
- How to know current Ubuntu Linux version via terminal command
- Add new user in Ubuntu Linux using Terminal Command
- Fix Ubuntu /bin/sh: 1: zsh: not found error
- How to install Python on Ubuntu
- [Fix] Ubuntu E: Unable to locate package sudo error
- How to stop MongoDB Server running on Ubuntu
- Install postgres Client using apt-get command
- How to kill service running on a port on Ubuntu Linux
- [fix] openssl No such file or directory error C++
- Fix - sudo: systemctl: command not found
- Access Windows share folder in Ubuntu Device in Network
- Add or remove users from sudo group - Ubuntu
- Quickly install Apache Server on Ubuntu Linux
- Fix: Ubuntu (Linux) - bash: sudo: command not found error
More Posts:
- Trace using cURL Command Example - cURL
- How to create MD5 digest in Notepad++ - NotepadPlusPlus
- Enable Native Dark Mode in Notepad++ - NotepadPlusPlus
- How to add days to a date in Python - Python
- Java Stream flatmap() Examples - Java
- See actual SharePoint error exception modify web.config - SharePoint
- Sublime Text 3 spell check shortcut - Sublime
- 18: Get Sub List By Slicing a Python List - 1000+ Python Programs - Python-Programs