Formula
Group
OS
Keywords
LinuxEnvironment VariablesOS
Last edited time
Apr 29, 2024 2:17 PM
Slug
Status
Draft
Title
Code inside page
Github
👉 Overview
👀 What ?
Environment variables in Linux are dynamic named values that are stored within the system and used by applications launched in shells or subshells. They can be created, edited, saved, and deleted, and provide a simple way to share configuration settings between multiple applications and processes in Linux. They are part of the environment in which a process runs.
🧐 Why ?
Understanding Linux environment variables is crucial as they control the behavior of the system and the applications that run within it. These variables help reduce the need for users to manually specify the path to executable files. They also allow customization of the system according to user's needs. For example, by setting the HOME environment variable, the system knows where the user's home directory is located.
⛏️ How ?
To view all environment variables, use the 'printenv' command. To create a new environment variable, use the 'export' command followed by the variable name and its value. For example 'export VARNAME=\
⏳ When ?
Linux environment variables have been in use since the inception of the Linux operating system. They are an integral part of Linux and Unix-like operating systems and are used on a daily basis by both system administrators and regular users.
⚙️ Technical Explanations
An environment variable in Linux is a named object that contains data used by one or more applications. By convention, environment variable names are uppercase, with words joined by underscores. Their values can be names of files, file paths, or any other type of information that a program needs to run. In essence, when a shell command is entered and the system needs to know the location of a binary, it checks the environment variables. The system also uses environment variables to handle data about the shell session, like the shell to use by default and the history size to keep. Understanding how to accurately manipulate these variables is a vital skill for managing Linux systems.