Dev.to Security πŸ” Cybersecurity πŸ‘ 0 πŸ“– 1 min read

🌐 Linux Free Masterclass (Episode 24): Environment Variables (printenv, echo, and export)

🌐 Linux Free Masterclass (Episode 24): Environment Variables (printenv, echo, and export) How does the shell remember your current username, locate executable commands across directories, or pass configuration settings

🌐 Linux Free Masterclass (Episode 24): Environment Variables (printenv, echo, and export)

🌐 Linux Free Masterclass (Episode 24): Environment Variables (printenv, echo, and export)

How does the shell remember your current username, locate executable commands across directories, or pass configuration settings to running programs? Through Environment Variables.

Here are the key points from Episode 24:
πŸ”Ή 1. What is an Environment Variable?
Dynamic Name-Value Pairs: Key-value settings stored in the shell environment that shape how programs, scripts, and the operating system behave.
System Memory: Tracks essential context such as your active user ($USER), executable search directories ($PATH), home directory ($HOME), and locale/language settings.
πŸ”Ή 2. Viewing Environment Variables (printenv & echo)
List All Variables: Run printenv to inspect all active environment variables in your current session.
Inspect a Specific Variable: Prefix the variable name with $ using echo:
echo $USER displays the current username.
echo $PATH shows the colon-separated list of directories searched when running commands.
πŸ”Ή 3. Creating & Exporting Custom Variables (export)
Make Variables Available to Subshells: Use export so child processes and scripts inherit the variable:
export COURSE="Linux"
Verify the Value: Run echo $COURSE to confirm it outputs Linux.

πŸš€ Think of environment variables like pre-saved system preference cards on your phoneβ€”your name, language, and time zone are stored once so every app doesn't have to ask you repeatedly!

Linux #EnvironmentVariables #Bash #SysAdmin #CyberSecurity #TechLearning #OpenSource

πŸ“° Read the original article on Dev.to Security

Originally published by Dev.to Security. Aggregated on AIWithGhost for educational purposes β€” full credit and traffic to the original publisher.