Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What are my environment variables? [closed]

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

like image 558
Halil Avatar asked Dec 13 '10 17:12

Halil


People also ask

How do I open environment variables?

On the Windows taskbar, right-click the Windows icon and select System. In the Settings window, under Related Settings, click Advanced system settings. On the Advanced tab, click Environment Variables.

What are my environment variables?

An environment variable is a variable whose value is set outside the program, typically through functionality built into the operating system or microservice. An environment variable is made up of a name/value pair, and any number may be created and available for reference at a point in time.


4 Answers

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
Linux: where are environment variables stored?

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

Happy reading :-)

like image 87
athspk Avatar answered Oct 12 '22 03:10

athspk


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
like image 33
joksnet Avatar answered Oct 12 '22 03:10

joksnet


Type export without any parameters.

like image 40
Ronnie Howell Avatar answered Oct 12 '22 04:10

Ronnie Howell


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.
like image 11
karlphillip Avatar answered Oct 12 '22 03:10

karlphillip