by on August 5, 2017
Customizing The Bash Shell 3/1/13 9:45 PM
ENV – Displays all environment variables
Env | grep varname – To look at a specific environment variable
Common Environment Variables
USER/USERNAME – Current user’s username “whoami” displays this
SHELL – Shell your user is working as. Bash is most common
TERM – Current Terminal
PS1 – Default bash prompt. Can include variables (more in “man bash”)
• \h hostname
• \w current working directory
• \u username
• \@ 12 hour am/pm date
• \t 24 hour hh:mm:ss
• \T 12 hour hh:mm:ss
• \j number of jobs running on the shell
• \d date (day of week, month, day of month)
• \H full hostname “”
• \$
HOME – Users home directory path
LD_LIBRARY_PATH – Directory in which libraries are found and bin
executable files are located
HOSTNAME – System hostname
PWD – Current working directory
EDITOR – Default editor when the system opens files
MAIL – Holds the location of the users mail spool
Aliases are used to create shortcuts to commands on your system. Unless
set in a bash configuration file aliases are destroyed or lost when you logout
of your shell session.
• Example: alias syslog=”tail –f /var/log/syslog”
o Typing syslog at the command prompt will invoke the tail –f
command on /var/log/syslog.
Global shell configuration files
User configuration files
/etc/skel – Contents of this directory are copied to new users directors
when the new user is created.
Custom Command Prompts – Edit PS1 Environment variable
\e[ - Indicates the beginning of color prompt
x;ym - Indicates color code.
\e[m - indicates the end of color prompt
example: export PS1="\e[37m\] \u \e[m\] \$
\e[37m\] – Opens color or the username \e[37m\] closes color
Bash Color Codes:
Black 0;30
Dark Gray 1;30
Blue 0;34
Light Blue 1;34
Green 0;32
Light Green 1;32
Cyan 0;36
Light Cyan 1;36
Red 0;31
Light Red 1;31
Purple 0;35
Light Purple 1;35
Brown 0;33
Yellow 1;33
Light Gray 0;37
White 1;37
Note: replace 0 with 1 to make it a dark color
Posted in: Education
Be the first person to like this
Page generated in 0.1909 seconds with 57 queries and GZIP enabled on