Skip to content

Instantly share code, notes, and snippets.

@mike-pt
Last active August 29, 2015 13:58
Show Gist options
  • Save mike-pt/10010697 to your computer and use it in GitHub Desktop.
Save mike-pt/10010697 to your computer and use it in GitHub Desktop.
#
# Thanks: http://cryptofroot.hateblo.jp/entry/20121025/1351105690
# for ksh substition alternative for PWD
# ${PWD/#$HOME/\~} would not work in NetBSD's ksh version
if [ `id -u` == 0 ]; then
PS1='$USER@${HOST%%.*}: ($([[ "${PWD#$HOME}" !!= "$PWD" ]] && print -n "~${PWD#$HOME}" || print -n "$PWD"))# '
else
# Remove last trailing slash from $HOME
# only needed for normal user
HOME="${HOME%/}"
PS1='$USER@${HOST%%.*}: ($([[ "${PWD#$HOME}" !!= "$PWD" ]] && print -n "~${PWD#$HOME}" || print -n "$PWD"))# '
fi
# $TTY is the tty we logged in on,
# $tty is that which we are in now (might by pty)
tty=`tty`
tty=`basename $tty`
TTY=${TTY:-$tty}
set -o emacs
alias __A=$(print '\0020') # ^P = up = previous command
alias __B=$(print '\0016') # ^N = down = next command
alias __C=$(print '\0006') # ^F = right = forward a character
alias __D=$(print '\0002') # ^B = left = back a character
alias __H=$(print '\0001') # ^A = home = beginning of line
alias ls='ls -CF'
alias ll='ls -laAh'
alias h='fc -l | more'
alias quit=exit
alias cls=clear
alias logout=exit
alias bye=exit
alias p='ps -l'
alias j=jobs
alias o='fg %-'
alias df='df -k'
alias du='du -k'
alias rsize='eval `resize`'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment