Shell | System-wide Initialization Files | Primary User Initialization Files Read at Login | User Initialization Files Read When a New Shell Is Started | Shell Path Name |
|---|---|---|---|---|
Bourne | /etc/profile | $HOME/.profile | /bin/sh | |
Korn | /etc/profile | $HOME/.profile $HOME/.kshrc | $HOME/.kshrc | /bin/ksh |
C | /etc/.login | $HOME/.cshrc $HOME/.login | $HOME/.cshrc | /bin/csh |
You need the following files in users home directory :
- .exrc
- .kshrc
- .profile
If you want Solaris10 for your username to track history commands you have to create in your home directory .sh_history file.
touch $HOME/.sh_history Content of .exrc
set nu
set showmode
Content of .kshrc
TERM=ansi;export TERM
SHELL=/usr/bin/ksh;export SHELL
PS1="$LOGNAME@`uname -n` \$PWD $";export PS1
PATH=$PATH:/usr/sbin:/usr/bin:/usr;export PATH
set -o vi
stty erase ^H
# banner Hello Sys Admin!
function num { who | wc -l; }
#
#
#
function list { ls -la | wc -l; }
#
#
function cluster { cat /var/sadm/system/admin/CLUSTER; }
#
function dow {
if [[ -z $1 ]] # Check for existence of option on command line
then
date +%A # If not, display day of week on stdout
return 0 # Return success
fi
case $1 in
-s) WEEKDAY=$(date +%A);; # If –s is used, set variable WEEKDAY
*) print “Format is dow [-s]” # Anything else is an error
return 1;; # Return failure
esac
}
Content of .profile
ENV=/home/`$LOGNAME`/.kshrc;export ENV
# ksh;exit ---> this line if your default shell is sth different then ksh
Displaying history of commands
There is nice feature of SHELL in Slaris10 called history of typed commands. It works in cooperation with data file
/$HOME/$LOGNAME/.sh_history.You can display history of recently typed commands :
history
1 ls -la
2 history
3 df -h
4 g
5 history
6 format
7 history
You can recall whatever line you want from the output of
history command by issuing :r 3It means recall third line.
The Korn Shell stores command history in a file specified by HISTFILE variable. The default is the ~/.sh_history file.You can use HISTSIZE variable to specify the number of commands to store in this buffer. If this variable is not set, then shell stores the most recent 128 cmds.
By default
historycommand displays the last 16 commands to the stdout. To display commands without line numbers :
history -nTo display the current command and 4 cmds preceding it :
history -4To display the history list in reverse order :
history -rTo display the mos recent
cd cmd to the most recent datecmd :history cd ls