Table of Content

Weight: 4

Description: Candidates should be able to customize shell environments to meet users’ needs. Candidates should be able to modify global and user profiles.

Key Knowledge Areas:

Set environment variables (e.g. PATH) at login or when spawning a new shell
Write Bash functions for frequently used sequences of commands
Maintain skeleton directories for new user accounts
Set command search path with the proper directory

The following is a partial list of the used files, terms and utilities:

.
source
/etc/bash.bashrc
/etc/profile
env
export
set
unset
~/.bash_profile
~/.bash_login
~/.profile
~/.bashrc
~/.bash_logout
function
alias
lists

+++ env variable

$ export HOSTNAME=carson.example.com

$ env DISPLAY=seeker.example.com:0.0 nedit # set up env only for one program

$ echo $PS1
[\u@\h \W]\$

+++ profile file

Global
login
/etc/profile
files in /etc/profile.d

non-login
/etc/bashrc or /etc/bash.bashrc

User
login
~/.bash_login, ~/.profile, or ~/.bash_profile

non-login
~/.bashrc

skeleton files
/etc/skel

logout scripts
~/.bash_logout

~/.inputrc, which helps customize your keyboard

+++ lists
You can chain together commands using various list operators. This is called a list or a list
of commands. You can use the following operators:
■ Semicolon (;) run one by one
■ Ampersand (&) run in background
■ Double ampersand (&&) the 2nd command is executed only if the 1st command completes successfully
■ Double vertical line or pipe (||) the 2nd command will be executed only if the 1st command does not execute successfully

&&
oldhorse@dclab:~$ date && pwd
Mon Mar 21 15:11:26 EDT 2016
/home/oldhorse

||
oldhorse@dclab:~$ date || pwd
Mon Mar 21 15:13:10 EDT 2016
oldhorse@dclab:~$ dte || pwd
dte: command not found
/home/oldhorse