# $Id: ksh.kshrc.local,v 1.7 2010/04/05 08:57:01 root Exp $ # # local global ksh interactive shell initialization # TODO remember to put the path for this script into /etc/changelist # # put the following in ~/.profile which is run by login shells: # # export ENV=$HOME/.kshrc # umask 022 # if [ -x /usr/bin/tset ]; then # if [ X"$XTERM_VERSION" = X"" ]; then # eval `/usr/bin/tset -sQ '-munknown:?vt220' $TERM` # else # eval `/usr/bin/tset -IsQ '-munknown:?vt220' $TERM` # fi # fi # # and this in ~/.kshrc which is run due to ENV pointer in .profile: # # . /etc/ksh.kshrc # . /etc/ksh.kshrc.local # # common settings export FTPMIRROR=ftp://ftp.eu.openbsd.org/pub/OpenBSD/$(uname -r) export PKG_PATH=$FTPMIRROR/packages/$(machine -a)/ export HISTSIZE=5000 export HISTFILE=$HOME/.history export PS1="\\$ " # settings depending on user if test x$(whoami) == xroot; then export PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:$HOME/bin #/bin/ls -lo $HISTFILE | /usr/bin/grep sappnd || /usr/bin/chflags sappnd $HISTFILE alias ls="ls -oFA" else export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/usr/games:$HOME/bin alias ls="ls -F" which colorls >/dev/null && alias ls="colorls -GF" test -x /usr/local/bin/remind -a -r ~/remind && remind ~/remind test -x /usr/games/fortune && (echo ""; /usr/games/fortune -s) fi # use vim if it's available if test -x /usr/local/bin/vim; then export VISUAL=/usr/local/bin/vim export EDITOR=/usr/local/bin/vim else export VISUAL=/usr/bin/vi export EDITOR=/usr/bin/vi fi set -o vi # use vi editing mode set -o noclobber # don't let redirects overwrite files # aliases alias ll="ls -lh" # long listing, human readable alias la="ls -a" # show hidden alias lls='ll -S' # sort after file size alias lla='ll -ut' # show atime alias llc='ll -ct' # show ctime alias llm='ll -t' # show mtime alias ..="cd .." alias p="ps uw" alias pa="ps auxw" alias df="df -h" alias du="du -h" alias rm="rm -i" alias mv="mv -i" alias cp="cp -i" alias rcslocks='rlog -L -R RCS/*' alias msgs='tail -n 15 /var/log/messages' alias indent='indent -i 4 -bli0 -ncs -npcs -nut' alias port='cat /usr/local/share/nmap/nmap-services | grep -i ' alias mac='cat /usr/local/share/nmap/nmap-mac-prefixes | grep -i ' alias d2h='perl -e "printf qq|%X\n|, int( shift )"' alias h2d='perl -e "printf qq|%d\n|, hex( shift )"' alias newest='ls -t | head -1' alias sortip="sort -u -n -t . -k 1,1 -k 2,2 -k 3,3 -k 4,4" alias striptags="sed 's/<[^>]*>//g'" # short version of whois swhois() { whois "$1" | egrep -i "inetnum|netname|descr|country" echo "" } # swap two file names around swap() { local tmpfile=tmp.$$ mv "$1" $tmpfile mv "$2" "$1" mv $tmpfile "$2" } # eof