Shell : How to List and Understand Your System’s Environment variables

Shell Scripting @

Environment variables play a crucial role in system configuration and application behavior. They store information that helps programs and the operating system interact effectively. In this article, we will explore how to write a shell script to list all environment variables and their respective values.

Create file using the nano text editor, run:


Write the Script

Inside ‘,’ write the following shell script:

# Use 'env' command to list all environment variables

This script utilizes the env command to display a list of all environment variables and their corresponding values.

Save the file and exit the text editor (e.g., in nano, press Ctrl + O to save and Ctrl + X to exit).

Before running the script, make it executable using the following command:

chmod +x

Now that the script is executable, you can run it to list all environment variables and their values:


The script will display an extensive list of environment variables and their associated values, which can be useful for system administration, debugging, or understanding how your system is configured.

Read more on Shell and Linux related articles

Other urls to refer

  1. PySpark Blogs
Author: user