Understanding and managing environment variables is crucial for Linux system administrators and developers. Environment variables store valuable information about the system's configuration, paths, and user preferences. Accessing and printing these variables can be highly beneficial for troubleshooting, debugging, and setting up the environment correctly. This tutorial shows how to print all environment variables on Linux.
The printenv
command prints a list of all the environment variables currently set on the Linux system. Each line of the output will display a variable name followed by its corresponding value. The output will include variables such as PATH, HOME, USER, and many others.
printenv
You might see output similar to the following:
SHELL=/bin/bash
SESSION_MANAGER=local/ubuntu:@/tmp/.ICE-unix/2957,unix/ubuntu:/tmp/.ICE-unix/2957
QT_ACCESSIBILITY=1
COLORTERM=truecolor
XDG_CONFIG_DIRS=/etc/xdg/xdg-ubuntu:/etc/xdg
SSH_AGENT_LAUNCHER=gnome-keyring
XDG_MENU_PREFIX=gnome-
GNOME_DESKTOP_SESSION_ID=this-is-deprecated
GTK_IM_MODULE=xim
LC_ADDRESS=en_US.UTF-8
...
Leave a Comment
Cancel reply