Skip to main content

What are the advantages and disadvantages of using zsh instead of bash (or other shells)?

Everything you know from bash still applies, but zsh does a bunch of other useful things. I know that I use only a small subset of them, but these are especially useful for me:

  • Extended globbing: For example, 
    *(.)
     matches only regular files, not directories, whereas 
    a*z(/)
     matches directories whose names start with 
    a
     and end with 
    z
    . There are a bunch of other things, such as 
    **
     as described by Ole Tange.
  • Inline glob expansion: For example, type 
    rm *.pdf
     and then hit tab. The glob 
    *.pdf
     will expand inline into the list of .pdf files, which means you can change the result of the expansion, perhaps by removing from the command the name of one particular file you don’t want to 
    rm
    .
  • Interactive path expansion: Type 
    cd /u/l/b
     and hit tab. If there is only one existing path each of whose components starts with the specified letters (that is, if only one path matches 
    /u*/l*/b*
    ), then it expands in place. If there are two, say 
    /usr/local/bin
     and 
    /usr/libexec/bootlog.d
    , then it expands to 
    /usr/l/b
    and places the cursor after the 
    l
    . Type 
    o
    , hit tab again, and you get 
    /usr/local/bin
    .
  • Nice prompt configuration options: For example, my prompt is currently displayed as 
    tov@zyzzx:/..cts/research/alms/talk
    . I prefer to see a suffix of my current working directory rather than have a really long prompt, so I have zsh abbreviate that portion of my prompt at a maximum length.

The ones not already listed here are :
  • Auto-correct on known commands

  • Auto-complete : This is different from the default bash autocomplete
    e.g
    You type 

    kill
    and press <tab>. Instead of a list of files in current directory, you'll see all your processes with their pids.


  • Remote auto-completion :
    So I can view remote file listings :


    Now if I press <tab>, I can view the remote directory listing on the remote server
  • Expand variables

    ~/    $PATH <tab>
    you get =>
    ~/    /usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/home/mridul/.rvm/bin
  • Use Alt-/ (forward slash) to move through argument history
  • Shared command history between all running shells.
    This is something some people appreciate and some others wouldn't like. But I find it useful for myself.

Advantages that I appreciate:
  1. Much easier prompt definitions. Particularly dynamic/multine prompts.
  2. Right Prompt? Yes, thank you!
  3. Awesome set (more comprehensive than BASH) of Auto Completions are much faster and smarter (e.g. case insensitive completion, smart defaults)
  4. Path Expansion is pure win. (cd /v/w [tab] == cd /var/www)
  5. Path Replacement is pretty cool also.
  6. Spelling Correction (setopt correct) is mighty awesome for me.
  7. oh-my-zsh - Large, community driven framework for all sorts of bells and whistles.
  8. The Zsh Line Editor... just google it
  9. Key Bindings? Yes, thank you!
  10. Globbing

Comments

Popular posts from this blog

HTML Emailing in ZF2

<?php namespace Application\Model; use Zend\Mail\Message; use Zend\Mime\Message as MimeMessage; use Zend\Mime\Part as MimePart; use Zend\Mail\Transport\Sendmail as SendmailTransport; use Zend\Mail\Transport\Smtp as SmtpTransport; use Zend\Mail\Transport\SmtpOptions; use Zend\View\Renderer\PhpRenderer; use Zend\View\Resolver\TemplatePathStack; use Zend\View\Model\ViewModel; use Zend\View\Model\ModelInterface; class ApiEmail extends ApiInterface {    protected $From = "XXXXX@gmail.com";    protected $FromName = "XXXX";    protected $To = "" ;    protected $Subject = "" ;    protected $Body = "" ;    protected $Cc = "XXXXXX@gmail.com";    protected $Bcc = "XXXXX@gmail.com" ;    protected $ReplyTo = "XXXX@gmail.com" ;    protected $Sender = "" ;    protected $Encoding = "UTF-8" ;    protected $MESSAGE ; // getter setter ...

How to setup django | django installation ubuntu

Introduction to Django 1.     High level web framework 1.     Basic modules, classes, and tools to quickly develop and deploy web apps 2.     Contains an ORM (Object-Relational Mapper) that allows for the use of standard Python language syntax when interfacing with a back-end database. 1.     Developer need not learn SQL, DDL, etc! 3.     Provides a template framework that allows HTML, XML, and other “documents” to be converted into “templates”, which can then be converted to “output” via a wide range of substitution techniques. 4.     Elegant URL support (fancy, beautiful URL's, no “?blah=blah”, etc.) 5.     Multi-lingual 2.     Fast and easy to use, robust, flexible, and lots of contributed components available! 1.     Built in administrative interface to manage data models. 2.     Built-in authentication/ac...

Using FileZilla and SFTP with OpenShift