What are my environment variables?

LinuxBashShellUbuntu

Linux Problem Overview


I would like to find out my environment variables in bash. Are they stored somewhere?

Linux Solutions


Solution 1 - Linux

I am not sure if thats what you want, but try printenv
This will show you all your environment variables.

About where they are stored
https://stackoverflow.com/questions/532155/linux-where-are-environment-variables-stored

How to set Shell Environment Variables
http://www.codecoffee.com/tipsforlinux/articles/030.html

Happy reading :-)

Solution 2 - Linux

Just execute env in a terminal.

Example output:

$ env
TERM=xterm
SHELL=/bin/bash
USER=joksnet
USERNAME=joksnet
DESKTOP_SESSION=gnome
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
PWD=/home/joksnet
GDM_KEYBOARD_LAYOUT=us
LANG=en_US.utf8
HOME=/home/joksnet
DISPLAY=:0.0
COLORTERM=gnome-terminal
_=/usr/bin/env

Solution 3 - Linux

Type export without any parameters.

Solution 4 - Linux

Or set:

SET(P)                                                                  POSIX Programmer’s Manual                                                                  SET(P)

NAME
       set - set or unset options and positional parameters

SYNOPSIS
       set [-abCefmnuvx][-h][-o option][argument...]

       set [+abCefmnuvx][+h][+o option][argument...]

       set -- [argument...]

       set -o

       set +o

DESCRIPTION
       If  no  options or arguments are specified, set shall write the names and values of all shell variables in the collation sequence of the current locale. Each name
       shall start on a separate line, using the format:

              "%s=%s\n", <name>, <value>

       The value string shall be written with appropriate quoting; see the description of shell quoting in Quoting . The output shall be  suitable  for  reinput  to  the
       shell, setting or resetting, as far as possible, the variables that are currently set; read-only variables cannot be reset.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionHalilView Question on Stackoverflow
Solution 1 - LinuxathspkView Answer on Stackoverflow
Solution 2 - LinuxjoksnetView Answer on Stackoverflow
Solution 3 - LinuxRonnie HowellView Answer on Stackoverflow
Solution 4 - LinuxkarlphillipView Answer on Stackoverflow