Zsh

From MichaelRpdx_memes
Jump to: navigation, search

Editing Zsh

zsh is a new shell to me. A few notes while I'm spinning up.

 for i in {42..69}; do echo $i; done
 will act on 42 through 69. much nicer that seq with backticks
 
 Peeved about filenames with embedded spaces?
 zmv '* *' '$f:gs/ /_'
 
 To see what you can glob echo *(<tab> and feast on over 40 options
 
 cmd -<tab> will tab expand to the options available for the command. 
     It doesn't know every program and command
 

Check out whatever this does

 zman() {
   PAGER="less -g -s '+/^       "$1"'" man zshall
 }

From rayninfo zshtips

 ls -lt  **/*(.om[1,20]) # lists the 20 newest files in the heirarchy
 
 # zsh list largest / biggest files , files larger than
 ls -l *(Lk+100)   # list file size larger/greater than 100kb 
 ls -l *(Lm+2)     # list file size larger/greater than 2 mbs 
 ls **/*(.Lm+10)   # list files larger than 10MB anywhere in hierarchy 
 ls -hlS **/*(.Lm+2)  | less  # list largest files  largest first  
 
 !!:gs/fred/joe/       # edit previous command replace all fred by joe

Other resources:

 zsh lovers 
 grml (live Linux CD) zsh page
 What's in your zshrc?
 Advent Calendar 2011

Trip up mode: if locale is set to C then Alt Gr key handling does not work - so no ñ € ̊ ¿ from the keyboard. Setting locale to a UTF-8 variant resolves the problem. It's a trip up because bash and Xapps will still work.