Solved

env variable file. what these different variables represent ?

Posted on 2011-02-25
3
624 Views
Last Modified: 2012-05-11
when i type env command on my linux, below output comes. what every different variable represents ? also how can i edit this file ? is it output from single file?


HOSTNAME=sys18
TERM=xterm
SHELL=/bin/bash
HISTSIZE=1000
SSH_CLIENT=192.168.0.41 34851 22
QTDIR=/usr/lib64/qt-3.3
OLDPWD=/usr/local
QTINC=/usr/lib64/qt-3.3/include
SSH_TTY=/dev/pts/7
USER=root
LS_COLORS=rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=01;05;37;41:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.lz=01;31:*.xz=01;31:*.bz2=01;31:*.tbz=01;31:*.tbz2=01;31:*.bz=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.axv=01;35:*.anx=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=01;36:*.au=01;36:*.flac=01;36:*.mid=01;36:*.midi=01;36:*.mka=01;36:*.mp3=01;36:*.mpc=01;36:*.ogg=01;36:*.ra=01;36:*.wav=01;36:*.axa=01;36:*.oga=01;36:*.spx=01;36:*.xspf=01;36:
CCACHE_DIR=/var/cache/ccache
MAIL=/var/spool/mail/root
PATH=/usr/lib64/qt-3.3/bin:/usr/kerberos/sbin:/usr/kerberos/bin:/usr/lib64/ccache:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin
PWD=/usr/local/hype
XMODIFIERS=@im=none
CCACHE_UMASK=002
KDE_IS_PRELINKED=1
LANG=en_GB
MODULEPATH=/usr/share/Modules/modulefiles:/etc/modulefiles
LOADEDMODULES=
KDEDIRS=/usr
SSH_ASKPASS=/usr/libexec/openssh/gnome-ssh-askpass
HISTCONTROL=ignoredups
SHLVL=1
HOME=/root
LOGNAME=root
QTLIB=/usr/lib64/qt-3.3/lib
CVS_RSH=ssh
SSH_CONNECTION=192.168.0.41 34851 192.168.0.41 22
MODULESHOME=/usr/share/Modules
LESSOPEN=|/usr/bin/lesspipe.sh %s
G_BROKEN_FILENAMES=1
_=/bin/env
0
Comment
Question by:aashee
  • 2
3 Comments
 
LVL 12

Expert Comment

by:upanwar
ID: 34978819
There are lots of files, where you can set the environment variable.

To set environemt variable for particular user then just add the varibale in user's bash_profile, it resides in user's home directory.

To change environmt variouble in environmet for all users, make the changes in /etc/profile.

0
 
LVL 12

Accepted Solution

by:
upanwar earned 250 total points
ID: 34978906
The varibale which are showing after typing of the env command are set from various files during the startup of the system. Like: /etc/bashrc, /etc/rc.d/rc.sysinit

for moreinfo about this just go through with the boot process of linux.

If you want to modify the the any environtment variable then just make the enrty in either user's bash_profile or /etc/profile or in /etc/bashrc.

after making the changes just source that file.

source <file name>

or if you want to make a temporary change then you can the values by just executing the same at the command prompt. Example is given below.

JAVA_HOME=/usr/java/jdk1.5.0_07/bin/java

export JAVA_HOME
0
 
LVL 10

Assisted Solution

by:Martin_J_Parker
Martin_J_Parker earned 250 total points
ID: 34979143
Many of those variables are set by the shell or login program that you are using.
For example, all the ones beginning with SSH are only going to be present for a user using an ssh shell.  A local user won't have those at all.

Some are set for particular programs that you have installed - for example QTDIR and QTINC and QTLIB are set for QT developers to tell the compiler where the QT top level directory is and where the include files and libraries are located.  If you don't use QT or don't have that installed then those variables won't need to be there.

There is no one place to find all of them as some are created by the shell, but assuming that you are using the bash shell, /etc/bashrc and /etc/profile will hold some of the variables for all users and then individual users can over-ride the globally set variables with their own .bash_profile file in their home directory.

If you update /etc/profile then use the format that upanwar suggests - 2 lines:
JAVA_HOME=/usr/java/jdk1.5.0_07/bin/java
export JAVA_HOME

If you want to update your own .bash_profile then you can either use that same 2 line format or combine them into a single line:
export JAVA_HOME=/usr/java/jdk1.5.0_07/bin/java

One reason to use the 2 line format in /etc/profile is because programs and users who insist on using the old Bourne Shell will find that the combined export command does not work for them!
0

Featured Post

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

rdate is a Linux command and the network time protocol for immediate date and time setup from another machine. The clocks are synchronized by entering rdate with the -s switch (command without switch just checks the time but does not set anything). …
Introduction We as admins face situation where we need to redirect websites to another. This may be required as a part of an upgrade keeping the old URL but website should be served from new URL. This document would brief you on different ways ca…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question