1. Shell Arguments →

    This in-depth article clarifies how your shell deals with word-splitting, quoting, and expansion. Well worth the read if you do any work in the shell.

  2. Aliases on the shell

    The easiest way to speed up your workflow in your shell is to create aliases for your most frequently used applications and their configuration settings. If you use zsh, these aliases can go into ~/.zshrc, but if you use bash they should go in ~/.bash_profile.

    A few sample aliases from my for git:

    alias g='git'
    alias ga='git add'
    alias gc='git commit -m'
    alias gac='git add -u && git commit -m "Auto commit"'

    Now, when I’m on my prompt, the aliases will be expanded by my shell after I hit return to execute the command.

    $ gc 'This is my commit message' 

    Expands to:

    $ git commit -m 'This is my commit message'

    Set Default Options

    You can also use this to set default options for commonly used programs.

    For example, let’s say you want to have ls display its output in list mode with color on OSX. I can just set up an alias like:

    alias ls='ls -lG'

    And now when I invoke ls on my prompt, it will automatically expand it as follows:

    $ ls -a /path/to/foo

    Expands to:

    $ ls -lG -a /path/to/foo

    More Examples

    alias p='pushd'
    alias o='popd'
    alias s='cd -'
    alias rcedit='mvim -f ~/.zshrc && source .zshrc'
    alias hostedit='sudo mvim -f /etc/hosts && dscacheutil -flushcache'

    Share your custom shell aliases and tips in the comments.