Software > Scripting Languages >
(on Wikipedia)
https://www.zsh.org/
A shell.
Though not usually available for a Linux distribution, it's exceptionally powerful enough that I insist upon it.
-
aka Z shell
Note that you will find a lot of example and working code on GitHub:
--
-
- As of 2019-11-17 it seems to have been reworked/abandoned.. with old content gone missing. Go exploring through archives if you're highly interested.
--
- 2019-11-17 - 5.3.1-4+b3 on Debian 10.1.0-amd64-xfce-CD-1
- 2016-03-28 - 5.0.2 on Slackware 14.1
- 2016-03-26 - 5.0.2 on Lubuntu 14.04.4 LTS
- 2009-07-18 - 4.3.9 on Unity Linux 0.99-alpha1
- 2009-04-21 - 4.3.9 on PCLinuxOS 2007
-
2009-04-21 - 4.2.6 on PCLinuxOS 2007
- This was an ancient version which they had in their repository.. it was released 2005-12-05. That's complete BS.
- 2006-04-22 - (version not recorded) on (distribution not recorded)
-
I had used this for a very long time on multiple distributions.
2016-03-28 - 5.0.2 ∞
zsh 5.0.2 (i486-slackware-linux-gnu)
I installed this with slpkg:
\slpkg -s sbo zsh
2016-03-26 - 5.0.2 ∞
zsh 5.0.2 (x86_64-pc-linux-gnu)
I installed this with Lubuntu's package manager.
(no particular notes were written)
2009-07-18 - 4.3.9 ∞
TODO: - https://wiki.archlinux.org/index.php/Zsh
Everything worked fine out of the box, except for the home
/end
bindings. I had to change them:
# home bindkey '^[[1~' beginning-of-line # end bindkey '^[[4~' end-of-line
It also turned out that most of the other customizations I did really were not needed, so I commented them out.
2009-04-21 - 4.3.9 ∞
Tested 2009-04-21 through to 2009-07-18
-
2009-04-21: Holy crap, Sourceforge is still stuck at 4.2.7, released between 2005-12-05 (4.2.6) and 2006-02-28 (4.3.1).
- A news entry for 4.2.7 didn't get released at http://zsh.sourceforge.net/News/
- I had to check https://www.zsh.org/pub/ for it.
- http://zsh.sourceforge.net/News/ doesn't include this. =/
-
omg, a first-run welcome and walkthrough! Re-run it with:
zsh Scripts/newuser
--
HISTFILE=~/.zsh/histfile
-
Configuring tab completion:
autoload -Uz compinstall
compinstall
-
I'm allowing the shell to choose my keybindings. This might be a bad idea.
setopt autocd setopt appendhistory setopt nomatch unsetopt beep setopt notify
The result was this ~/.zshrc
-
Aliases are not sane. no colour
ls
.- took the stuff from my .bashrc
-
Allow the user to paste into the console, and allow the # to comment things. DUH.
setopt INTERACTIVE_COMMENTS
-
zshwiki.org/home/zle/bindkeys?s=typeset key bindings (hotkeys)
- http://zshwiki.org/home/keybindings/
- Learn a key with
control-v
and then the sequence. - TODO:
control-left
/control-right
-- Maybe override with.Xresources
-
The default prompt is garbage.
A basic prompt, in my ~/.zshrc
put:
autoload -U promptinit && promptinit prompt suse
A nicer prompt:
Bash had:
PS1="\w\[\e[34;1m\] > \[\e[0m\]"
zsh has:
PS1=%~$'%{\e[34;1m%} > %{\e[0m%}'
also, you can be more cool like this:
autoload -U colors && colors PS1="%{$fg[red]%}%n%{$reset_color%}@%{$fg[blue]%}%m %{$fg[yellow]%}%~ %{$reset_color%}%% "
I have NO FREAKING CLUE how to do attribute changing. Nobody else does either.
- If playing around with stuff, restart zsh with:
exec zsh
-
Fix the title, add this to
~/.zshrc
:
# Update the title of an xterm chpwd() { [[ -t 1 ]] || return case $TERM in sun-cmd) print -Pn "\e]l%~\e\\" ;; *xterm*|rxvt|(dt|k|E)term) print -Pn "\e]2;%~\a" ;; esac } # And force the title to update on startup chpwd
Changing my default shell:
su chsh -s /usr/local/bin/zsh user
Then log out (restart X) for it to be effective.
Notes ∞
- zsh-lovers - tips, tricks and examples for the Z shell
-
sjl's oh-my-zsh - a framework for managing zsh configuration
- Check out
ZSH_THEME_GIT_PROMPT_UNTRACKED
- Check out
- using coproc to send a job into the background and still work with it.
- quality bitching
- an ancient guide
- Curtains up: introducing the Z shell
-
character index
-
- Not 64 bit
- As of 2016-01-29 not updated since 2010.
- .. just use Windows Subsystem for Linux or even Virtualization instead.
You probably don't want .zshrc
to produce output, either, since there are occasions when this can be a problem, such as when using rsh from another host.
See this http://zsh.sourceforge.net/FAQ/zshfaq03.html#321 to see what I should put in .zshrc
to save my history.
Tab completion ∞
pressing tab
on a blank line should cycle through executables in the current directory
cd <tab>
should cycle through directories in the current directory-
compctl -g '*.(ps|eps)' ghostview
-- this will limit theghostview
command totab
-complete certain file extensions.
Prompt notes ∞
# Left prompt PS1='B(%h) %m%#%b' # Right prompt RPS1='(%20<...<%~)'
ported old review notes
finished porting