1 - There's a thing called "oh-my-zsh" which supposedly sets up your ~/.zshrc file, but I found that gave a selection of super-ugly prompts, selected by name, like "alan1", and somehow prevented changing the prompt to something better.
Edit: I use a white background on terminals and the few prompts I tried were almost unreadable.
2 - There's another thing called
zsh-newuser-install
which sets up some settings - that I'm probably missing by using the .zshrc file below - but also provided ugly, unchangeable prompts. So here's a bare bones version, using neither of the above:
Install
zsh
- probably already installed.Make a
~/.zshrc
file (the two products mentioned above do this, but I didn't like the result).cat ~/.zshrc
Edit: updated version (03Mar'21)
Code: Select all
#
# ~/.zshrc
#
HISTFILE=~/.config/zsh-histfile
HISTSIZE=4000
SAVEHIST=4000
bindkey -v
unset zle_bracketed_paste
export PS1="%F{red}Z:%f%d : "
export TIME_STYLE="long-iso" # YYYY-MM-DD
# Tab completion: seems to work without these two lines?
# need them so that cd /u/sb/[tab]-> /usr/share
autoload -U compinit
compinit
# enable zsh calculator zcalc
autoload zcalc
# cd to dir by dir-name
setopt autocd
# associtate file suffix with opener:
alias -s {txt,conf}=vi
alias -s {htm,html}=firefox
alias -s {jpg,jpeg,png,gif,bmp}=iview
#
alias -g S=" | sort "
alias -g SN=" | sort -n"
alias -g SH=" | sort -h"
alias -g G=" | grep "
alias -g L=" | less "
#
alias zv=" vi ~/.zshrc"
alias zs="source ~/.zshrc"
#
alias cdm='(){ cd /mnt/$1 }'
alias data='(){ cd /mnt/DATA/$1 }'
alias down='(){ cd /mnt/DATA/download/$1 }'
alias h='(){ history "-"$1 }' # return last N, passing postive N
#
alias hg='history 1 | grep ' # search all history
#
# copied from .bashrc - NONE of the below are zsh-specific
#
alias iv='iview '
alias sud='sudo env PATH=$PATH'
alias Su='su - '
#
export QUOTING_STYLE=literal
#
export LANG=en_US.UTF-8
export LANGUAGE=en_US.UTF-8
export LC_ALL="C"
export LC_COLLATE="C"
#
# EOF
~/.zprofile
file; dunno if you even need it, but I based mine on the ~/.bash_profile
file:cat .zprofile
Code: Select all
#
# ~/.zprofile
[[ -f ~/.zshrc ]] && . ~/.zshrc
Code: Select all
zsh
. ~/.zshrc
or . ./.zshrc
if you're at $HOME; it won't take . .zshrc
(perhaps it would if "." was in the PATH...)To make it permanent, enter these
chsh -l
# list the shellschsh -s /bin/zsh
# use the FULL PATH of zsh returned from chsh -l
Now when you login or start a terminal, you'll be running zsh.
If you get hosed up, return to bash by typing
Code: Select all
bash