Five Command Line Tools to Help You Work Faster

I remember when I viewed the command line as some esoteric art only used by the Wizards of the Back-End. Now, I can’t get enough of it. If you’re only using the terminal to navigate directories or change permissions, here’s a list of some awesome utilities that can help you work faster and kick butt in the command line interface.

Note: This list assumes you’re comfortable with basic commands and have homebrew installed. Don’t have either and unsure where to start? No worries, I’ve got you covered:

1. Get to Directories Faster with autojump

Ever find yourself laboriously typing the path of a theme directory seven folders deep? With autojump, you only have to type the folder name, and you're there.

Do you type:

cd ~/Sites/drupal/docroot/sites/all/themes/example-theme

before - cd ~/Sites/docroot/sites/all/themes/example-theme

Now you can type:

j example-theme

after - j example-theme

To install autojump:

brew install autojump

Autojump learns about directories as you use them, so make sure to navigate to a few of your favorites before you start using. Now rest those tired finger bones.

2. Share Files with transfer.sh

Ever need to quickly send a database or site folder to a client or colleague? With transfer.sh, you can share the file with one command:

transfer filename

transfer filename.tar.gz

You're good to go.

To use transfer.sh, add this to your .bash_profile:

transfer() { if [ $# -eq 0 ]; then echo "No arguments specified. Usage:\necho transfer /tmp/test.md\ncat /tmp/test.md | transfer test.md"; return 1; fi
tmpfile=$( mktemp -t transferXXX ); if tty -s; then basefile=$(basename "$1" | sed -e 's/[^a-zA-Z0-9._-]/-/g'); curl --progress-bar --upload-file "$1" "https://transfer.sh/$basefile" >> $tmpfile; else curl --progress-bar --upload-file "-" "https://transfer.sh/$1" >> $tmpfile ; fi; cat $tmpfile; rm -f $tmpfile; }; alias transfer=transfer

3. Homebrew Cask Installs Apps from the Shell

When you need to download an application, do you: Google the program, download it and manually drag the file to the Applications folder? Homebrew Cask can download and install it for you with a single line:

brew cask install application-name

brew cask install firefox

Boom. You’re done.

To install homebrew cask:

brew install caskroom/cask/brew-cask

You can search for Casks by typing:

brew cask search application-name

Note: The install location can get a little weird. Add this to your .bash_profile to generate a shortcut in your Applications folder:

export HOMEBREW_CASK_OPTS="--appdir=/Applications"

4. The Silver Searcher Lets You Quickly Search Files and Folders

The Silver Searcher is my favorite command line search tool. Can’t remember where that pesky button component was placed in an inherited project? Type:

ag search-string folder-name

ag .button scss

You are now free to toss grep out the window.

To install The Silver Searcher:

brew install the_silver_searcher

5. Oh My Zsh Can Turn Your Terminal into Something You Want to Look At

Oh My Zsh can do a lot to make your life easier. For simplicity, let’s use Oh My Zsh to beautify our shell with a theme. If your terminal is easier to read, you can scan the info you need faster.

To install Oh My Zsh:

curl -L https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh | ZSH=~/.dotfiles/zsh sh

First, pick a theme. Now, edit ~/.zshrc on this line with your new theme’s name:

line - ZSH_THEME=

My favorite is agnoster. It even lists some git info automagically:

agnoster theme example with git info

Note: The file ~/.zshrc is where you store your aliases now, so if you’ve been following along and adding items to your ~./bash_profile, then you’ll want to transfer those over to your new ~/.zshrc file.

I hope this list helps make your flow faster and your life easier. Feel free to list some of your favorites in the comments below. And remember:

You're a wizard, Harry.