User Tools

Site Tools


ubuntu:environment_variables

Ubuntu - Environment variables

Environment Variables are dynamic values which affect the processes or programs on a computer.

Environment variables are case-sensitive and usually they are created in upper case.


Commands for managing Environment Variables

Environment variables are case-sensitive and usually they are created in upper case.

CommandDescription
echo $VARIABLETo display value of a variable.
printenvDisplays all or part of environment variables,
envDisplays all exported environment variables.
VARIABLE_NAME= variable_valueCreate a new variable.
setDisplay the name and value of each shell variable.
unsetRemove a variable.
export Variable=valueTo set value of an environment variable.

Common Environment Variables

System VariableMeaningTo View Variable Value Type
BASH_VERSIONHolds the version of this instance of bash.echo $BASH_VERSION
HOSTNAMEThe name of the your computer.echo $HOSTNAME
CDPATHThe search path for the cd command.echo $CDPATH
HISTFILEThe name of the file in which command history is saved.echo $HISTFILE
HISTFILESIZEThe maximum number of lines contained in the history file.echo $HISTFILESIZE
HISTSIZEThe number of commands to remember in the command history. The default value is 500.echo $HISTSIZE
USERThe username of the current userecho $USER
HOMEThe home directory of the current user.echo $HOME
IFSThe Internal Field Separator that is used for word splitting after expansion and to split lines into words with the read builtin command. The default value is <space><tab><newline>.echo $IFS
LANGUsed to determine the locale category for any category not specifically selected with a variable starting with LC_.echo $LANG
PATHThe search path for commands. It is a colon-separated list of directories in which the shell looks for commands.echo $PATH
PS1Your prompt settings.echo $PS1
TMOUTThe default timeout for the read builtin command. Also in an interactive shell, the value is interpreted as the number of seconds to wait for input after issuing the command. If not input provided it will logout user.echo $TMOUT
TERMYour login terminal type.echo $TERM; export TERM=vt100
SHELLPath to login shell being used by the user.echo $SHELL
DISPLAYSet X display nameecho $DISPLAY; export DISPLAY=:0.1
EDITORPath to the program which edits the content of filesexport EDITOR=/usr/bin/vim
UIDUser's unique IDecho $UID
ubuntu/environment_variables.txt · Last modified: 2020/07/15 09:30 by 127.0.0.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki