CLI Tools

  1. nexe: Create a single executable out of your node.js apps
  2. git-absorb: git commit --fixup, but automatic

Tip of the Week

Using shell history to be quick and efficient:

  • The ‘arrow-up’ key inserts your previous command
  • Use ctrl-r keyboard shortcut to search through your history
  • Zsh has a builtin r (alias for fc -e -) command:
      % kubectl --context dev-gke get pods -n namespace
      % r dev=prod
      kubectl --context prod-gke get pods -n namespace
    
  • The history command, which is really just fc, has numerous flags:
    • fc alone open your editor of choice to edit the last command
    • fc -l prints your recent history
    • fc <num> opens your editor with the command with that history ID
    • fc <num> <num> edits commands in that range
    • fc -s <num> runs the command without editing
  • The ever-popular !! for executing the previous command without editing
    • !!:s/foo/bar executes the last command, replacing the first ‘foo’ with ‘bar’ (like r)
    • !!:gs/foo/bar is the same as above, except replacing all instances of ‘foo’
    • !!:$ inserts the last argument from the previous command into your new command (aliased to !$)
        % mkdir /tmp/baz
        % cd !$
        cd /tmp/baz
      

You can find more info in Unix Power Tools, 3rd Edition.