Hello, I’m Joni

an excitable brand strategist

Command Line Primer Primer

14 January 2015

This post specifically addresses the Mac OS X Terminal. I can definitely say that one of the more intimidating things I accomplished in 2014 was getting comfortable with the command line process. I was very hesitant to even use it at first: What if I delete something? What if I tell my computer to spontaneously combust? Why is it so ugly?…I will just use apps!

Illustrated helm behind a terminal screen.

Because of this intimidation factor with the terminal I tried to avoid it at all costs, which very quickly became silly and inefficient. I ended up tackling the basics head on, making it much less scary and fostering a more efficient workflow.

Let’s take a glance at some basic level commands, shortcuts, and use cases to get started using the command line with less sweat and tears (or perhaps that was just me) with this oddly laid out primer to primers.

The What What?

The Terminal is a program included with all versions of Mac OS X and resides in the Utilities folder. The Terminal grants us access to the command line. If our computers were ships, the command line grants us access to the captain’s seat.

From this position of power we can tell our computer to do exactly as it’s told through a text based interface.

But Why?

There are several advantages to bossing your computer around through the command line over apps. It’s free, it’s fast, it’s more thorough, it debugs and tells you about errors. You cut out the middle man and go directly to your computer’s control center.

Steering Away From Apps

Part of my enthusiasm for the command line was ignited by frustration with app limitations. While I definitely see the initial appeal of them, they just simply can’t do everything that can be done via the command line. Not to mention that you may need several apps to accomplish what can be done through one terminal.

One example of this limitation is that, even though I should be able to, I cannot merge branches via the GitHub app. This alone renders this app almost completely not useable to me.

How?

The Terminal resides in the Utilities folder on a Mac and is ready to accept commands as soon as it is opened.

Screenshot of the Terminal icon on Mac

Basic Commands & Shortcuts

While the abilities of the command line can be quite vast, there are some basic commands and shortcuts you will find yourself needing and using regularly.

List of common Mac OS X command line shortcuts

List of common Mac OS X command line commands

Here’s a little PDF if that is more your fruit spread.

Use Cases

Let’s quickly review a very common use of the command line, navigating files and getting a Git status on a repository. With the command line we can check to see if there are any changes in my An Apple A Day project repository that need to be committed.

Preview of command line process to find Git repository and check status

No changes to commit! If there were we could do that right from the command line as well.

Git

There’s a really neat hands on Git tutorial to get your started managing your GitHub repositories with the command line, as well as this introduction by Steve Klise.

Completely new to Git? This might prove to be a good starting place.

Sass

Setting up Sass with the command line and running Gulp will also most likely become part of your daily routine.

Completely new to Sass? This guide provides a great, basic intro.

Go Forth & Command

The command line can be one of the more seemingly difficult and intimidating aspects of web development, but having a basic concept of the commonly used commands and shortcuts can free you of app dependency and streamline your workflow.

It’s important to keep in mind that with the Terminal comes great power, power that can potentially do terrible things to the unseasoned user’s computer. When in doubt about a command or shortcut always be sure to Google the answer before proceeding.

While this post is by no means (seriously, not even close) a complete summary of how to use the command line, hopefully it eliminates some of the evasiveness around the terminal by addressing some of the more frequently used commands. For a more exhaustive introduction I recommend taking a look at the OS X command line manual or this video tutorial.