Quantcast
Channel: Planet Plone - Where Developers And Integrators Write
Viewing all articles
Browse latest Browse all 3535

Mikko Ohtamaa: Five ZSH tricks to optimize your shell workflow

$
0
0

Below on the video I’ll demonstrate five handy tricks you can do with zsh shell. zsh is a powerful command line shell for UNIX operating systems (Linux, Ubuntu, OSX, etc.) Newcomer shell users may find these tips helpful.

You want to use zsh because it make you type less, find command faster and ultimately make you more productive when working with UNIX and servers.

The tips are based on our tuned ztanesh shell scripts which you may wan to install too :)

1) Navigate around on the file system using zsh “menu select” tab completion. Writing a path to the command line equals to cd‘ing that directory in zsh. What we do here is that we open the tab completion in the current folder using the dot slash notation and then find our way to the target folder. The menu select constructs the path for us. Instructions how to set up zsh’s menu select for this.

2) Back to the previous folder where you were: cd -. Handy when you jump around in the directory tree when working. You can type only cd to go to the home folder. .. (even without cd) takes you one level higher, … two lever higher and so on.

3) Move a file using the menu select completion as shown in the first trick. You can open menu completion for any command or target.

4) zsh has superior tab completion compared to other shells: here I autocomplete an SSH host and use the menu selector to choose it from the list. zsh can also complete scp copy remote filenames. Other example is kill command where the tab completion allows you to choose the target process in a menu.

5) CTRL+R for the history search. Type CTRL + R and few letters of any of your previous commands and CTRL+R again to find it up (incremental search with history-incremental-pattern-search-backward). No need to navigate through the long backlog using up arrow. I don’t know how I managed to live 15 years without getting this to my muscle memory.

Also on the video you can see how the terminal tab colorization by the current (ssh‘ed) server works.

For more useful keybindings on OSX / iTerm 2, see how to bind ALT + arrow to move between words and fn + arrow to move to the beginning and the end of the line.

More tips welcome. Especially I am interested in

  • Fuzzy / partial string match for the history earch (Sublime Text 2 CTRL+T style go to anywhere)
  • Menu select for the history search

 

 Subscribe to this blog in a reader Follow me on Twitter


Viewing all articles
Browse latest Browse all 3535

Trending Articles