Linux Environment Variables

Linux Environment Variables

Linux has many environment variables. A few worth remembering are pwd, path, PS1, USER and VISUAL. These environment variables can be used during each session. Alternatively, you can create environment variables which will last for your SSH session.

Using Environment Variables

root@vps [~]# echo $PATH 
/usr/local/jdl/bin:/usr/kberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin:/usr/X11R7/bin:/root/bin 

root@vps [~]# echo $USER 
root 
root@vps [~]# echo $VISUAL 
pico

Creating Environment Variables

root@vps [~]# VAR="Hello" 
root@vps [~]# export VAR 
root@vps [~]# bash 
root@vps [~]# echo $VAR 
Hello