Wenn man Lust auf was neues hat, oder einfach findet, dass die bash zu wenig ist, der kann auf zsh umsteigen.
Die Installation ist recht einfach und das gibt dazu auch schon eine Anleitung (Mirror).
Die Anleitung deckt die Grundlagen ab, aber es gibt noch so ein paar Feinheiten, die ich selber herausfinden musste, damit alles so lief wie ich wollte.
Meine /etc/zsh/zprofile in der ich die globalen Einstellungen hinterlegt habe:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# Load environment settings from profile.env, which is created by # env-update from the files in /etc/env.d if [ -e /etc/profile.env ] ; then . /etc/profile.env fi # You should override these in your ~/.zprofile (or equivalent) for per-user # settings. For system defaults, you can add a new file in /etc/profile.d/. export EDITOR=${EDITOR:-/bin/vi} export PAGER=${PAGER:-/usr/bin/less} # 077 would be more secure, but 022 is generally quite realistic umask 022 # Set up PATH depending on whether we're root or a normal user. # There's no real reason to exclude sbin paths from the normal user, # but it can make tab-completion easier when they aren't in the # user's PATH to pollute the executable namespace. # # It is intentional in the following line to use || instead of -o. # This way the evaluation can be short-circuited and calling whoami is # avoided. if [ "$EUID" = "0" ] || [ "$USER" = "root" ] ; then PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:${ROOTPATH}" else PATH="/usr/local/bin:/usr/bin:/bin:${PATH}" fi export PATH unset ROOTPATH shopts=$- setopt nullglob for sh in /etc/profile.d/*.sh ; do [ -r "$sh" ] && . "$sh" done unsetopt nullglob set -$shopts unset sh shopts # make the * act normal setopt noglob # completion autoload -U compinit compinit # prompt autoload -U promptinit promptinit prompt fire blue blue blue white white white export HISTSIZE=2000 export HISTFILE="$HOME/.history" export SAVEHIST=$HISTSIZE setopt hist_ignore_all_dups |
Geändert habe ich Zeile 9. Da war der nano als Editor eingestellt und nicht VI.
Ab Zeile 39 sind alles die globalen Einstellungen die für alle user gelten. Somit muss man sich in der .zshrc des einzelnen Benutzers nicht viel rein schreiben.
Was nun noch ein Problem war, ist die Funktion der Einfg,pos1,bild etc. Tasten. Diese haben bei mir nicht funkionert und das ist schon ärgerlich. Daher muss man noch folgendes in seine ~/.zshrc rein schreiben. (Es funktioniert nicht wenn es in der /etc/zsh/zprofile enthalten ist)
case $TERM in
xterm*)
# Pos1 && End
bindkey '^[OH' beginning-of-line ## Pos1
bindkey '^[OF' end-of-line ## End
bindkey '^[[3~' delete-char ## Entf
bindkey '^[[5~' history-beginning-search-backward ## Page Up
bindkey '^[[6~' history-beginning-search-forward ## Page Down
;;
screen*)
# Pos1 && End
bindkey '^[[1~' beginning-of-line ## Pos1
bindkey '^[[4~' end-of-line ## End
bindkey '^[[3~' delete-char ## Entf
bindkey '^[[5~' history-beginning-search-backward ## Page Up
bindkey '^[[6~' history-beginning-search-forward ## Page Down
;;
esac
Dies macht die Tasten verfügbar und normales arbeiten wie auf der bash ist wieder möglich.
Zu beachten ist, dass dies für jeden Benutzer gemacht werden sollte, denn es scheint nicht zu funktionieren.
Wenn man nun noch möchte, dass man erkennt wenn man als root angemeldet ist, dann kann man einfach seinen Prompt in der /root/.zshrc überscheiben:
# prompt
autoload -U promptinit
promptinit
prompt fire
Somit ist klar, dass man als root arbeitet ;-)
