Skip to main content
Sheelah Brennan

Productivity Tip #3: Embrace the Command Line

I just realized that one year ago I wrote the first blog post on this site. Time flies! Time for another productivity tip – learn to love the command line. Although I am biased because as a systems administrator/devops person in a past life I became very comfortable with the command line, I think it’s something that all web developers should take time to learn — either on Mac OSX, Unix, or Linux.

Life is too short to be stuck clutching the mouse constantly. If you want to work more efficiently, the command line provides the biggest bang for your buck.

Time-Saving Benefits of the Command Line

There are tons of guides out there for learning the command line. Below are some of the key benefits of putting the command line to use.

  1. Startup file to store your preferences and command aliases: Whatever your shell of choice (Bash, Zsh, Ksh, etc), you can set up a startup file (a .bashrc file for Bash, .zshrc file for Zsh, etc) that will be executed each time you open a new shell window (like when you open up iTerm or Terminal on a Mac). You can store command aliases in this file that let you quickly run often-run commands with little typing. Below are two sample lines from my .zshrc. The first sets an alias to let me quickly start up the Opera Mobile emulator just by typing ‘operamobile’ and the second specifies how I want my command line prompt to look:
alias operamobile='/usr/local/share/applications/operamobile/opera-mobile.sh -geometry 320x480'
PROMPT='%F{red}<%F{green}%n@%m%F{white}:%F{cyan}%~%F{red}>%{$reset_color%}'

For some more ideas, see the dotfiles site on github.

  1. Quick navigation between directories: The command line allows you to easily change directories without any mouse clicking. For example, cd will take you back to your home directory, and cd - will take you back to your previous directory. For more advanced users, there is pushd and popd for efficient directory transversal.
  2. Access to commands to copy files to remote machines (scp, rsync, or sftp): With the command line, you don’t need a separate utility to copy files to your web host or other machine. You can just type in a command.
  3. Ability to take advantage of other command line tools like Git and Grunt: By being comfortable with the command line, you can start installing and utilizing software that has a CLI (command line interface). For example, Git and Grunt both have one (in fact, this is the only way to use Grunt). The CLI is always faster than using a GUI.
  4. Command line completion for even less typing: command line completion, in which your system automatically fills in partially typed commands, saves a lot of typing. It works with the tab key by default. Couldn’t live without this one.
  5. Command line editing: You can get all fancy and set up command line editing in either emacs or vi mode. This lets you easily recover when you see a typo in a command that you entered (before you hit enter), letting you edit your command without having to re-type the whole line. This comes in especially handy when your command is a long one! I use this constantly.

Follow Me

Built with ♥ and Gatsby, hosted on Netlify

My new Skillshare course: Make Your Website Stand Out