ZSH (a.k.a. Ze best SHell in ze world)

History timestamps

HISTFILE=~/.history
HISTSIZE=9999
SAVEHIST=9999

setopt extendedhistory

alias history='history -i -d 1'

Prompt

A nice colorfull prompt

autoload -U colors && colors
if [ $UID = 0 ]
then
        PS1="%{$terminfo[bold]$fg[red]%}%m %{$fg[blue]%}%2~ %{$reset_color%}%# "
else
        PS1="%{$terminfo[bold]$fg[green]%}%n@%m %{$fg[blue]%}%2~ %{$reset_color%}%# "
fi

Some notes on this:

  • Adding the autoload stuff allows you to set explicit color-names.
  • The $terminfo[bold] statement makes colors brighter.
  • The prompt will display a green user@host for non-privileged users, and a red host when being root, followed by the last two directories of your path or the ~ sign if you're in your home directory (2~).

Right prompt

ZSH doesn't only have a left prompt, it can also have a right one. for instance, to display the the return code of the last typed command, add this in your .zshrc:

RPROMPT='%?'

Window/Tab title

case $TERM in
    xterm*|rxvt*|Eterm|aterm|kterm|gnome)
        precmd () {print -Pn "\e]0;%n@%m: %2~\a"}
        ;;
esac