http://www.cyberciti.biz/howto/shell-primer-configuring-your-linux-unix-osx-environment/

O</span>n a Linux or Unix-like systems each user and process runs in a specific environment. An environment includes variables, settings, aliases, functions and more. Following is a very brief introduction to some useful shell environment commands, including examples of how to use each command and setup your own environment to increase productivity in the command prompt.

bash-shell-welcome-image

Finding out your current shell</h2>
Type any one of the following command at the Terminal app:

ps</span> $$
ps</span> -p $$</pre>
OR

echo</span> "$0"</span></pre>

Sample outputs:

Fig.01: Finding out your shell name</a>

Fig.01: Finding out your shell name</p>

</div>

Finding out installed shells</h2>
To find out the full path for installed shell type:

type</span> -a zsh</span>
type</span> -a ksh
type</span> -a sh</span>
type</span> -a bash</pre>
Sample outputs:

Fig.02: Finding out your shell path</a>

Fig.02: Finding out your shell path</p>

</div>
The /etc/shells</kbd> file contains a list of the shells on the system. For each shell a single line should be present, consisting of the shell's path, relative to root. Type the following
cat command</a>to see shell database:

cat</span> /etc/shells</pre>
Sample outputs:

# List of acceptable shells for chpass(1).
# Ftpd will not allow users to connect who are not using
# one of these shells.
 
/bin/bash
/bin/csh
/bin/ksh
/bin/sh
/bin/tcsh
/bin/zsh
/usr/local/bin/fish</pre>

Changing your current shell temporarily</h2>
Just type the shell name. In this example, I'm changing from bash to zsh:

zsh</span></pre>
You just changed your shell temporarily to zsh. Also known as subshell. To exit from subshell/temporary shell, type the following command or hit CTRL-d</kbd>:

exit</span></pre>

Finding out subshell level/temporary shell nesting level</h3>
The $SHLVL</kbd> incremented by one each time an instance of bash is started. Type the following command:

echo</span> "$SHLVL"</span></pre>
Sample outputs:

Fig. 03: Bash shell nesting level (subshell numbers)</a>

Fig. 03: Bash shell nesting level (subshell numbers)</p>

</div>

Changing your current shell permanently with chsh</kbd> command</h2>
Want to change your own shell</strong> from bash to zsh permanently? Try:

chsh</span> -s /bin/zsh</span></pre>
Want to change the other user's shell</strong> from bash to ksh permanently? Try:

sudo</span> chsh</span> -s /bin/ksh userNameHere</pre>

Finding out your current environment</h2>
You need to use the

env</span>
env</span> | more</span>
env</span> | less</span>
env</span> | grep</span> 'NAME'</span></pre>
Sample outputs:

TERM_PROGRAM=Apple_Terminal
SHELL=/bin/bash
TERM=xterm-256color
TMPDIR=/var/folders/6x/45252d6j1lqbtyy_xt62h40c0000gn/T/
Apple_PubSub_Socket_Render=/tmp/launch-djaOJg/Render
TERM_PROGRAM_VERSION=326
TERM_SESSION_ID=16F470E3-501C-498E-B315-D70E538DA825
USER=vivek
SSH_AUTH_SOCK=/tmp/launch-uQGJ2h/Listeners
__CF_USER_TEXT_ENCODING=0x1F5:0:0
PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin:/usr/local/go/bin:/usr/local/sbin/modemZapp:/Users/vivek/google-cloud-sdk/bin
__CHECKFIX1436934=1
PWD=/Users/vivek
SHLVL=2
HOME=/Users/vivek
LOGNAME=vivek
LC_CTYPE=UTF-8
DISPLAY=/tmp/launch-6hNAhh/org.macosforge.xquartz:0
_=/usr/bin/env
OLDPWD=/Users/vivek</pre>
Here is a table of commonly used bash shell variables:

Fig.04: Common bash environment variables

Fig.04: Common bash environment variables</p>

</div>

Warning:</strong> It is always a good idea not to change the following environment variables. Some can be changed and may results into unstable session for you:
SHELL
UID
RANDOM
PWD
PPID
SSH_AUTH_SOCK
USER
HOME
LINENO</kbd>

Displays the values of environment variables</h2>
Use any one of the following command to show the values of environment variable called HOME:

## Use printenv ##</span>
printenv HOME
 
## or use echo</span> ##</span>
echo</span> "$HOME"</span>
 
# or use printf</span> for</span> portability ##</span>
printf</span> "%s\n</span>"</span> "$HOME"</span></pre>
Sample outputs:

/home/vivek</pre>

Adding or setting a new variables</h2>
The syntax is as follows in bash or zsh or sh or ksh shell:

## The syntax is ##</span>
VAR=</span>value
FOO=</span>bar
 
## Set the default editor to vim ##</span>
EDITOR=</span>vim
export</span> $EDITOR</span>
 
## Set default shell timeout for</span> security ##</span>
TMOUT=</span>300
export</span> TMOUT
 
## You can directly use export</span> command</span> to set</span> the search path for</span> commands ##</span>
export</span> PATH=</span>$PATH</span>:$HOME</span>/bin:/usr/local</span>/bin:/path/to/mycoolapps
</pre>
Again, use the printenv</kbd> or echo</kbd> or printf</kbd> command to see the values of environment variables called PATH, EDITOR, and TMOUT:

printenv PATH
echo</span> "$EDITOR"</span>
printf</span> "%s\n</span>"</span> $TMOUT</span></pre>

How do I change an existing environment variables?</h3>
The syntax is as follows:

export</span> VAR=</span>value
## OR ##</span>
VAR=</span>value
export</span> $VAR</span>
 
## Change the default editor from vim to emacs ##</span>
echo</span> "$EDITOR"</span> ## <--- print vim</span>
EDITOR=</span>emacs ## <--- change it </span>
export</span> $EDITOR</span> ## <--- export</span> it for</span> next session too </span>
echo</span> "$EDITOR"</span> ## <--- print emacs </span>
</pre>
The syntax is as follows for the tcsh shell for adding or changing a variables</strong>:

## Syntax </span>
setenv var value
printenv var
 
## Set foo variable with bar as</span> a value ##</span>
setenv foo bar
echo</span> "$foo"</span>
printenv foo
 
## Set PATH variable ##</span>
setenv PATH $PATH</span>\:$HOME</span>/bin
echo</span> "$PATH"</span>
 
## set</span> PAGER variable ##</span>
setenv PAGER most
printf</span> "%s\n</span>"</span> $PAGER</span>
</pre>

Finding your bash shell configuration files</h2>
Type the following command to list your bash shell files, enter:

ls</span> -l ~/.bash* ~/.profile /etc/bash* /etc/profile</pre>
Sample output:

Fig.05:  List all bash environment configuration files</a>

Fig.05: List all bash environment configuration files</p>

</div>
To look at all your bash config files, enter:

less</span> ~/.bash* ~/.profile /etc/bash* /etc/profile</pre>
You can edit bash config files one by one using the text editor such as vim or emacs:

vim ~/.bashrc</pre>
To edit files located in /etc/, type:

## first make</span> a backup.. just in</span> case</span> </span>
sudo</span> cp</span> -v /etc/bashrc /etc/bashrc.bak.22_jan_15
 
########################################################################</span>
## Alright, edit it to your hearts content and by all means, have fun ##</span>
## with your environment or just increase the productivity :)</span> ##</span>
########################################################################</span>
sudo</span> vim /etc/bashrc</pre>

Confused by Bash shell Initialization files?</h3>
The following "
bash file initialization</a>" graph will help you:
BashStartupfiles

Depending on which shell is set up as your default, your user profile or system profile can be one of the following:

Finding your zsh shell configuration files</h3>
The zsh
wiki</a> recommend the following command:

strings</span> =zsh</span> | grep</span> zshrc</pre>
Sample outputs:

/etc/zshrc
.zshrc</pre>
Type the following command to list your zsh shell files, enter:

ls</span> -l /etc/zsh</span>/* /etc/profile ~/.z*</pre>
To look at all your zsh config files, enter:

less</span> /etc/zsh</span>/* /etc/profile ~/.z*</pre>

Finding your ksh shell configuration files</h3>

  1. See ~/.profile</kbd> or /etc/profile</kbd> file.</li>
    </ol>

    Finding your tcsh shell configuration files</h3>

    1. See ~/.login</kbd>, ~/.cshrc</kbd> for the C shell.</li>
    2. See ~/.tcshrc</kbd> and ~/.cshrc</kbd> for the TC shell.</li>
      </ol>

      Can I have a script like this execute automatically every time I login?</h3>
      Yes, add your commands or aliases or other settings to ~/.bashrc</kbd> (bash shell) or ~/.profile</kbd> (sh/ksh/bash) or ~/.login</kbd> (csh/tcsh) file.

      Can I have a script like this execute automatically every time I logout?</h3>
      Yes, add your commands or aliases or other settings to ~/.bash_logout</kbd> (bash) or ~/.logout</kbd> (csh/tcsh) file.

      History: Getting more info about your shell session</h2>
      Just type the history command to see session history:

      history</span></pre>
      Sample outputs:

          9  ls
      10 vi advanced-cache.php
      11 cd ..
      12 ls
      13 w
      14 cd ..
      15 ls
      16 pwd
      17 ls
      ....
      ..
      ...
      91 hddtemp /dev/sda
      92 yum install hddtemp
      93 hddtemp /dev/sda
      94 hddtemp /dev/sg0
      95 hddtemp /dev/sg1
      96 smartctl -d ata -A /dev/sda | grep -i temperature
      97 smartctl -d ata -A /dev/sg1 | grep -i temperature
      98 smartctl -A /dev/sg1 | grep -i temperature
      99 sensors</pre>
      Type history 20</kbd> to see the last 20 commands from your history:

      history</span> 20</pre>
      Sample outputs:

      Fig.06:  View session history in the bash shell using history command</a>

      Fig.06: View session history in the bash shell using history command</p>

      </div>
      You can reuses commands. Simply hit [Up]</kbd> and [Down]</kbd> arrow keys to see previous commands. Press [CTRL-r]</kbd> from the shell prompt to search backwards through history buffer or file for a command. To repeat last command just type !!</kbd>at a shell prompt:

      ls</span> -l /foo/bar
      !!</pre>
      To see command #93 (hddtemp /dev/sda</kbd>)from above history session, type:

      !93</pre>

      Changing your identity with sudo or su</h2>
      The syntax is as follows:

      su</span> userName
       
      ## To log in</span> as</span> a tom user ##</span>
      su</span> tom
       
      ## To start a new login</span> shell for</span> tom user ##</span>
      su</span> tom
       
      ## To login</span> as</span> root user ##</span>
      su</span> -
       
      ## The sudo</span> command</span> syntax (</span>must be configured on your system)</span> ##</span>
      sudo</span> -s
      sudo</span> tom
      </pre>
      See "
      Linux Run Command As Another User</a>" post for more on sudo, su and runuser commands.

      Shell aliases</h2>
      An alias is nothing but shortcut to commands.

      Listing aliases</h3>
      Type the following command:

      alias</span></pre>
      Sample outputs:

      alias ..='cd ..'
      alias ...='cd ../../../'
      alias ....='cd ../../../../'
      alias .....='cd ../../../../'
      alias .4='cd ../../../../'
      alias .5='cd ../../../../..'
      alias bc='bc -l'
      alias cd..='cd ..'
      alias chgrp='chgrp --preserve-root'
      alias chmod='chmod --preserve-root'
      alias chown='chown --preserve-root'
      alias cp='cp -i'
      alias dnstop='dnstop -l 5 eth1'
      alias egrep='egrep --color=auto'
      alias ethtool='ethtool eth1'
      </pre>

      Create an alias</h3>
      The bash/zsh syntax is:

      alias</span> c=</span>'clear'</span>
      alias</span> down=</span>'sudo /sbin/shutdown -h now'</span></pre>
      Type c alias for the system command clear, so we can type c instead of clear command to clear the screen:

      c</pre>
      Or type down to shutdown the Linux based server:

       
      down
      </pre>
      You can create as many aliases you want. See "
      30 Handy Bash Shell Aliases For Linux / Unix / Mac OS X</a>" for practical usage of aliases on Unix-like system.

      Shell functions</h2>
      Bash/ksh/zsh functions allows you further customization of your environment. In this example, I'm creating a simple bash function called memcpu() to display top 10 cpu and memory eating process:

       
      memcpu(</span>)</span> {</span> echo</span> "*** Top 10 cpu eating process ***"</span>; ps</span> auxf | sort</span> -nr -k 3 | head</span> -10;
      echo</span> "*** Top 10 memory eating process ***"</span>; ps</span> auxf | sort</span> -nr -k 4 | head</span> -10; }</span>
      </pre>
      Just type memcpu to see the info on screen:

      memcpu
       
      *** Top 10 cpu eating process ***
      nginx 39559 13.0 0.2 264020 35168 ? S 04:26 0:00 \_ /usr/bin/php-cgi
      nginx 39545 6.6 0.1 216484 13088 ? S 04:25 0:04 \_ /usr/bin/php-cgi
      nginx 39471 6.2 0.6 273352 81704 ? S 04:22 0:17 \_ /usr/bin/php-cgi
      nginx 39544 5.7 0.1 216484 13084 ? S 04:25 0:03 \_ /usr/bin/php-cgi
      nginx 39540 5.5 0.1 221260 19296 ? S 04:25 0:04 \_ /usr/bin/php-cgi
      nginx 39542 5.4 0.1 216484 13152 ? S 04:25 0:04 \_ /usr/bin/php-cgi
      nixcraft 39543 5.3 0.1 216484 14096 ? S 04:25 0:04 \_ /usr/bin/php-cgi
      nixcraft 39538 5.2 0.1 221248 18608 ? S 04:25 0:04 \_ /usr/bin/php-cgi
      nixcraft 39539 5.0 0.1 216484 16272 ? S 04:25 0:04 \_ /usr/bin/php-cgi
      nixcraft 39541 4.8 0.1 216484 14860 ? S 04:25 0:04 \_ /usr/bin/php-cgi
       
      *** Top 10 memory eating process ***
      498 63859 0.5 4.0 2429652 488084 ? Ssl 2014 177:41 memcached -d -p 11211 -u memcached -m 2048 -c 18288 -P /var/run/memcached/memcached.pid -l 10.10.29.68 -L
      mysql 64221 4.2 3.4 4653600 419868 ? Sl 2014 1360:40 \_ /usr/libexec/mysqld --basedir</span>=/usr --datadir=/var/lib/mysql --user=mysql --log-error=/var/log/mysqld.log --open-files-limit=65535 --pid-file=/var/run/mysqld/mysqld.pid --socket=/var/lib/mysql/mysql.sock</span>
      nixcraft 39418 0.4 1.1 295312 138624 ? S 04:17 0:02 | \_ /usr/bin/php-cgi
      nixcraft 39419 0.5 0.9 290284 113036 ? S 04:18 0:02 | \_ /usr/bin/php-cgi
      nixcraft 39464 0.7 0.8 294356 99200 ? S 04:20 0:02 | \_ /usr/bin/php-cgi
      nixcraft 39469 0.3 0.7 288400 91256 ? S 04:20 0:01 | \_ /usr/bin/php-cgi
      nixcraft 39471 6.2 0.6 273352 81704 ? S 04:22 0:17 \_ /usr/bin/php-cgi
      vivek 39261 2.2 0.6 253172 82812 ? S 04:05 0:28 \_ /usr/bin/php-cgi
      squid 9995 0.0 0.5 175152 72396 ? S 2014 27:00 \_ (squid) -f /etc/squid/squid.conf
      cybercit 3922 0.0 0.4 303380 56304 ? S Jan10 0:13 | \_ /usr/bin/php-cgi
      </pre>
      See "
      how to write and use shell functions</a>" for more information.

      Putting it all together: Customizing your Linux or Unix bash shell working environment</h2>
      Now, you are ready to configure your environment using bash shell. I'm only covering bash. But the theory remains same from zsh, ksh and other common shells. Let us see how to adopt shell to my need as a sysadmin. Edit your ~/.bashrc file and append settings. Here are some useful configuration options for you.

      #1: Setting up bash path and environment variables</h3>

      # Set path ##</span>
      export</span> PATH=</span>$PATH</span>:/usr/local</span>/bin:/home/vivek/bin:/opt/firefox/bin:/opt/oraapp/bin
       
      # Also set</span> path for</span> cd</span> command</span>
      export</span> CDPATH=</span>.:$HOME</span>:/var/www
      </pre>
      Use less or most command as a pager:

      export</span> PAGER=</span>less</pre>
      Set vim as default text editor for us:

      export EDITOR=vim
      export VISUAL=vim
      export SVN_EDITOR="$VISUAL"</pre>
      Set Oracle database specific stuff:

      export</span> ORACLE_HOME=</span>/usr/lib/oracle/xe/app/oracle/product/10.2.0/server
      export</span> ORACLE_SID=</span>XE
      export</span> NLS_LANG=</span>$(</span>$ORACLE_HOME</span>/bin/nls_lang.sh</span>)</span></pre>
      Set JAVA_HOME and other paths for java as per java version:

      export</span> JAVA_HOME=</span>/usr/lib/jvm/java-6-sun/jre
       
      # Add ORACLE, JAVA to PATH</span>
      export</span> PATH=</span>$PATH</span>:$ORACLE_HOME</span>/bin:$JAVA_HOME</span>/bin
      </pre>
      Secure my remote
      SSH login using keychain for password less login</a>:

      # No need to input password again ever</span>
      /usr/bin/keychain $HOME</span>/.ssh</span>/id_rsa
      source</span> $HOME</span>/.keychain/$HOSTNAME</span>-sh</span></pre>
      Finally,
      turn on bash command completion</a>

      source</span> /etc/bash_completio</pre>

      #2: Setting up bash command prompt</h3>
      Set
      custom bash prompt (PS1)</a>:

      PS1=</span>'{\u</span>@\h</span>:\w</span> }\$</span> '</span></pre>

      #3: Setting default file permissions</h3>

      ## Set default to 644</span> ##</span>
      umask</span> 022</pre>

      #4: Control your shell history settings</h2>

      # Dont put duplicate lines in</span> the history</span>
      HISTCONTROL=</span>ignoreboth
       
      # Ignore these commands</span>
      HISTIGNORE=</span>"reboot:shutdown *:ls:pwd:exit:mount:man *:history"</span>
       
      # Set history</span> length via HISTSIZE and HISTFILESIZE</span>
      export</span> HISTSIZE=</span>10000
      export</span> HISTFILESIZE=</span>10000
       
      # Add timestamp to history</span> file</span>.</span>
      export</span> HISTTIMEFORMAT=</span>"%F %T "</span>
       
      #Append to history</span>, don</span>'t overwrite shopt -s histappend </span></pre>

      #5: Set the time zone for your session</h3>

      ## set</span> to IST for</span> my own session ##</span>
      TZ=</span>Asia/Kolkata</pre>

      #6: Setting up shell line editing interface</h3>

      ## use a vi-style line editing interface for</span> bash from default emacs mode ##</span>
      set</span> -o vi</pre>

      #7: Setting up your favorite aliases</h3>

      ## add protection ##</span>
      alias</span> rm=</span>'rm -i'</span>
      alias</span> cp=</span>'cp -i'</span>
      alias</span> mv=</span>'mv -i'</span>
       
      ## Memcached ##</span>
      alias</span> mcdstats=</span>'/usr/bin/memcached-tool 10.10.29.68:11211 stats'</span>
      alias</span> mcdshow=</span>'/usr/bin/memcached-tool 10.10.29.68:11211 display'</span>
      alias</span> mcdflush=</span>'echo "flush_all" | nc 10.10.29.68 11211'</span>
       
      ## Default command</span> options ##</span>
      alias</span> vi=</span>'vim'</span>
      alias</span> grep=</span>'grep --color=auto'</span>
      alias</span> egrep=</span>'egrep --color=auto'</span>
      alias</span> fgrep=</span>'fgrep --color=auto'</span>
      alias</span> bc=</span>'bc -l'</span>
      alias</span> wget=</span>'wget -c'</span>
      alias</span> chown=</span>'chown --preserve-root'</span>
      alias</span> chmod=</span>'chmod --preserve-root'</span>
      alias</span> chgrp=</span>'chgrp --preserve-root'</span>
      alias</span> rm=</span>'rm -I --preserve-root'</span>
      alias</span> ln=</span>'ln -i'</span>
      </pre>
      Here are some additional OS X Unix bash shell aliases:

      # Open desktop apps from bash</span>
      alias</span> preview=</span>"open -a '$PREVIEW'"</span>
      alias</span> safari=</span>"open -a safari"</span>
      alias</span> firefox=</span>"open -a firefox"</span>
      alias</span> chrome=</span>"open -a google\ </span>chrome"</span>
      alias</span> f=</span>'open -a Finder '</span>
       
      # Get rid of those .DS_Store files </span>
      alias</span> dsclean=</span>'find . -type f -name .DS_Store -delete'</span></pre>

      #8: Colour my world</h3>

      # Get colored grep</span> output </span>
      alias</span> grep=</span>'grep --color=auto'</span>
      export</span> GREP_COLOR=</span>'1;33'</span>
       
      # colored ls</span> too</span>
      export</span> LSCOLORS=</span>'Gxfxcxdxdxegedabagacad'</span>
      # Gnu/linux ls</span>
      ls=</span>'ls --color=auto'</span>
       
      # BSD/os x ls</span> command</span>
      # alias</span> ls=</span></span>'ls -G'</span></pre>

      #9: Setting up your favorite bash functions</h3>

      # Show top 10</span> history</span> command</span> on screen </span>
      function</span> ht {</span>
      history</span> | awk</span> '{a[$2]++}END{for(i in a){print a[i] " " i}}'</span> | sort</span> -rn | head</span>
      }</span>
       
      # Wrapper for</span> host and ping</span> command</span>
      # Accept http:// or https:// or ftps:// names for</span> domain and hostnames</span>
      _getdomainnameonly(</span>)</span>{</span>
      local</span> h=</span>"$1"</span>
      local</span> f=</span>"${h,,}"</span>
      # remove protocol part of hostname</span>
      f=</span>"${f#http://}"</span>
      f=</span>"${f#https://}"</span>
      f=</span>"${f#ftp://}"</span>
      f=</span>"${f#scp://}"</span>
      f=</span>"${f#scp://}"</span>
      f=</span>"${f#sftp://}"</span>
      # remove username and/or username:password part of hostname</span>
      f=</span>"${f#*:*@}"</span>
      f=</span>"${f#*@}"</span>
      # remove all /foo/xyz.html* </span>
      f=</span>${</span>f%%/*}</span>
      # show domain name only</span>
      echo</span> "$f"</span>
      }</span>
       
       
      ping</span>(</span>)</span>{</span>
      local</span> array=</span>(</span> $@ )</span> # get all args in</span> an array</span>
      local</span> len=</span>${</span>#array[</span>@]</span>}</span> # find</span> the length of an array</span>
      local</span> host=</span>${</span>array[</span>$len</span>-1]</span>}</span> # get the last</span> arg</span>
      local</span> args=</span>${</span>array[</span>@]</span>:0:$len</span>-1}</span> # get all args before the last</span> arg in</span> $@ in</span> an array </span>
      local</span> _ping=</span>"/bin/ping"</span>
      local</span> c=</span>$(</span>_getdomainnameonly "$host"</span>)</span>
      [</span> "$t"</span> != "$c"</span> ]</span> && echo</span> "Sending ICMP ECHO_REQUEST to \"</span>$c\"</span>..."</span>
      # pass args and host</span>
      $_ping</span> $args</span> $c</span>
      }</span>
       
      host(</span>)</span>{</span>
      local</span> array=</span>(</span> $@ )</span>
      local</span> len=</span>${</span>#array[</span>@]</span>}</span></span>
      local</span> host=</span>${</span>array[</span>$len</span>-1]</span>}</span>
      local</span> args=</span>${</span>array[</span>@]</span>:0:$len</span>-1}</span>
      local</span> _host=</span>"/usr/bin/host"</span>
      local</span> c=</span>$(</span>_getdomainnameonly "$host"</span>)</span>
      [</span> "$t"</span> != "$c"</span> ]</span> && echo</span> "Performing DNS lookups for \"</span>$c\"</span>..."</span>
      $_host</span> $args</span> $c</span>
      }</span></pre>

      #10: Configure bash shell behavior via shell shopt options command</h3>
      Finally, you can make changes to your bash shell environment using set and shopt</a> commands:

      # Correct dir</span> spellings</span>
      shopt</span> -q -s cdspell
       
      # Make sure display get updated when terminal window get resized</span>
      shopt</span> -q -s checkwinsize
       
      # Turn on the extended pattern matching features </span>
      shopt</span> -q -s extglob
       
      # Append rather than overwrite history</span> on exit</span>
      shopt</span> -s histappend
       
      # Make multi-line commandsline in</span> history</span>
      shopt</span> -q -s cmdhist
       
      # Get immediate notification of background job termination</span>
      set</span> -o notify
       
      # Disable [</span>CTRL-D]</span> which</span> is used to exit</span> the shell</span>
      set</span> -o ignoreeof</pre>

      Conclusion</h2>
      This post is by no means comprehensive. It provided a short walkthrough of how to customize your enviorment. For a thorough look at bash/ksh/zsh/csh/tcsh capabilities, I suggest you read the man page by typing the following command:

      man</span> bash
      man</span> zsh</span>
      man</span> tcsh
      man</span> ksh</pre>

      This article was contributed by Aadrika T. J.; Editing and additional content added by admin. You can too contribute to nixCraft</a>.</p>