q is for query

q is a small tool for performing repetitive tasks from the console. Where you use rake to automate a project’s tasks, you’d use q to automate your own workflow a little. q commands are relatively free-form, with a few built-in ones that I use frequently enough:

  1. Searching via Google:

    q search search terms

    Searches for the passed-in terms on Google. Synonyms are google, g.

  2. Looking up Wikipedia articles:

    q wikipedia toast

    Looks up the named article on Wikipedia. A synonym is wp.

  3. Looking up Ruby core class docs:

    q ruby Hash

    Looks up the docs for Hash on ruby-doc.org. A synonym is rb.

  4. Looking up Cocoa/related documentation:

    q ns Array

    Looks up the docs for NSArray in the on-disk filesystem (uses globbing to find them); therefore it doesn’t require an internet connection and finishes very quickly. Synonyms are: ca, cf, cg, dom, eagl, gl, glu, ib, qt, ui, web.