[el7_blog]
/dev/urandom

shell environment

The environment consists of variables that define the user environment, such as $PATH. Variables are fixed names that can be assigned dynamic values. The advantage for scripts and programs of working with variables is that the program only has to use the name of the variable without taking interest in the specific value that is assigned to the variable. Becasue the needs for different users are different, the variables that are set in a user environment will differ. Type env to get an overview of the current variables defined in your shell environment.


[root@el7_blog.local]# env
HOSTNAME=el7_blog.local.local
TERM=xterm
SHELL=/bin/bash
HISTSIZE=1000
SSH_CLIENT=192.168.X.X 8367 22
QTDIR=/usr/lib64/qt-3.3
OLDPWD=/root
QTINC=/usr/lib64/qt-3.3/include
SSH_TTY=/dev/pts/0
USER=root
LIBGL_DRIVERS_PATH=/usr/lib/dri:/usr/lib64/dri
MAIL=/var/spool/mail/root
PATH=/usr/lib64/qt-3.3/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin
PWD=/root
LANG=en_US.UTF-8
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.X.X 8367 192.168.X.X 22
LESSOPEN=||/usr/bin/lesspipe.sh %s
G_BROKEN_FILENAMES=1
_=/bin/env

To define a variable, the name of the variable is mentioned followed by an equals sign (=) and the value that is assigned to the specific variable.

Environment Configuration Files

  • /etc/profile: This is the generic file that is processes by all users upon login.
  • /etc/bashrc: This file is processed when subshells are started.
  • ~/.bash_profile: In this file, user-specific login shell variables can be defined.
  • ~/.bashrc: In this user-specific file, subshell variables can be defined.


re-load ~/.bash_profile -or- ~/.bashrc on the fly, i.e.without having to log out and in:

source ~/.bash_profile
source ~/.bashrc
. ~/.bash_profile
. ~/.bashrc


/etc/motd and /etc/issue
Bash offers an option to include messages in the /etc/motd and /etc/issue files. Messages in /etc/motd display after a user has successfully logged into a shell. Another way to send information to users is by using /etc/issue. The contents of this file display before the user logs in.