zsh shell-for-humans
DESCRIPTION
ZSH, a shell for human lecture during Developers Conference 2013TRANSCRIPT
![Page 1: Zsh shell-for-humans](https://reader034.vdocuments.us/reader034/viewer/2022042607/559c1abe1a28ab1d598b47e5/html5/thumbnails/1.jpg)
zsh- a shell for humans
@juandebravo
![Page 2: Zsh shell-for-humans](https://reader034.vdocuments.us/reader034/viewer/2022042607/559c1abe1a28ab1d598b47e5/html5/thumbnails/2.jpg)
First goal: this prompt
![Page 3: Zsh shell-for-humans](https://reader034.vdocuments.us/reader034/viewer/2022042607/559c1abe1a28ab1d598b47e5/html5/thumbnails/3.jpg)
• Is it a new shell? No… it’s been there since 1990!
• It’s newer than bash? Well… less than a year (bash was born in 1989)!
• why has it become popular? Due to oh-my-zsh
![Page 4: Zsh shell-for-humans](https://reader034.vdocuments.us/reader034/viewer/2022042607/559c1abe1a28ab1d598b47e5/html5/thumbnails/4.jpg)
How to install
# Debian/Ubuntu!
> sudo apt-get install zsh!
# Mac OS X!
> brew info zsh!
> brew install --disable-etcdir zsh
![Page 5: Zsh shell-for-humans](https://reader034.vdocuments.us/reader034/viewer/2022042607/559c1abe1a28ab1d598b47e5/html5/thumbnails/5.jpg)
Set as default shell
> chsh -s $(which zsh)
![Page 6: Zsh shell-for-humans](https://reader034.vdocuments.us/reader034/viewer/2022042607/559c1abe1a28ab1d598b47e5/html5/thumbnails/6.jpg)
Nice autocompletion: cd
![Page 7: Zsh shell-for-humans](https://reader034.vdocuments.us/reader034/viewer/2022042607/559c1abe1a28ab1d598b47e5/html5/thumbnails/7.jpg)
Nice autocompletion: git
![Page 8: Zsh shell-for-humans](https://reader034.vdocuments.us/reader034/viewer/2022042607/559c1abe1a28ab1d598b47e5/html5/thumbnails/8.jpg)
Nice autocompletion: ssh
![Page 9: Zsh shell-for-humans](https://reader034.vdocuments.us/reader034/viewer/2022042607/559c1abe1a28ab1d598b47e5/html5/thumbnails/9.jpg)
Globbing> mkdir connect{“-api”,"-backend","-commons"}!
> ls -l **/foo.java!
> ls **/*.py(.x)!
> ls -l */**(Lk+100)!
> vi **/README.md!
![Page 10: Zsh shell-for-humans](https://reader034.vdocuments.us/reader034/viewer/2022042607/559c1abe1a28ab1d598b47e5/html5/thumbnails/10.jpg)
path expansion
![Page 11: Zsh shell-for-humans](https://reader034.vdocuments.us/reader034/viewer/2022042607/559c1abe1a28ab1d598b47e5/html5/thumbnails/11.jpg)
path replacement
![Page 12: Zsh shell-for-humans](https://reader034.vdocuments.us/reader034/viewer/2022042607/559c1abe1a28ab1d598b47e5/html5/thumbnails/12.jpg)
Spelling correction
![Page 13: Zsh shell-for-humans](https://reader034.vdocuments.us/reader034/viewer/2022042607/559c1abe1a28ab1d598b47e5/html5/thumbnails/13.jpg)
Aliases
# Normal alias!
> alias ..=“cd ..”!
![Page 14: Zsh shell-for-humans](https://reader034.vdocuments.us/reader034/viewer/2022042607/559c1abe1a28ab1d598b47e5/html5/thumbnails/14.jpg)
Aliases
# Global alias!
> alias -g gp=“| grep -i | grep -v grep”!
> ps -ef gp redis!
=> ps -ef | grep -i redis | grep -v grep!
![Page 15: Zsh shell-for-humans](https://reader034.vdocuments.us/reader034/viewer/2022042607/559c1abe1a28ab1d598b47e5/html5/thumbnails/15.jpg)
Aliases
# Suffix alias!
> alias -s md=“subl”!
> README.md!
=> subl README.md!
![Page 16: Zsh shell-for-humans](https://reader034.vdocuments.us/reader034/viewer/2022042607/559c1abe1a28ab1d598b47e5/html5/thumbnails/16.jpg)
Prompt
PROMPT='$(machine_name) [%~]$(rvm_prompt_info)$(nvm_prompt_info)$(python_prompt_info)$(hg_prompt_info)$(git_prompt_info)%{$reset_color%}!
%{$fg[red]%}$(prompt_char) %{$reset_color%}'
python_prompt_info() {!
[ $VIRTUAL_ENV ] && echo " %{$fg[yellow]%}~`basename $VIRTUAL_ENV`%{$reset_color%}”!
}
![Page 17: Zsh shell-for-humans](https://reader034.vdocuments.us/reader034/viewer/2022042607/559c1abe1a28ab1d598b47e5/html5/thumbnails/17.jpg)
Prompt
python_prompt_info() {!
[ $VIRTUAL_ENV ] && echo " %{$fg[yellow]%}~`basename $VIRTUAL_ENV`%{$reset_color%}”!
}
![Page 18: Zsh shell-for-humans](https://reader034.vdocuments.us/reader034/viewer/2022042607/559c1abe1a28ab1d598b47e5/html5/thumbnails/18.jpg)
Right Prompt
RPROMPT='$(battery_charge) $(current_time)'
![Page 19: Zsh shell-for-humans](https://reader034.vdocuments.us/reader034/viewer/2022042607/559c1abe1a28ab1d598b47e5/html5/thumbnails/19.jpg)
Libraries on top of zsh
> oh-my-zsh: https://github.com/robbyrussell/oh-my-zsh!
> Prezto: https://github.com/sorin-ionescu/prezto!
![Page 20: Zsh shell-for-humans](https://reader034.vdocuments.us/reader034/viewer/2022042607/559c1abe1a28ab1d598b47e5/html5/thumbnails/20.jpg)
More cool stuffhttp://fishshell.com/
![Page 21: Zsh shell-for-humans](https://reader034.vdocuments.us/reader034/viewer/2022042607/559c1abe1a28ab1d598b47e5/html5/thumbnails/21.jpg)
Thanks!
Juan de Bravo!
@juandebravo!
DEVCON 2013