Command Line Essentials

Command Line Essentials

It wasn’t too long ago that I was terrified of the terminal. It’s pretty daunting to be staring at a blank screen with a blinking cursor taunting you. Want to know something? It’s not as scary as you might think. It would take years to master the command line, so don’t expect to know everything all at once. Everyday, try and find little ways to slowly blend the terminal with basic tasks. Slowly, you’ll find that it makes a lot of things easier.


You may have heard words such as “terminal”, “command line”, “shell”, “bash”, etc. There are slight differences, but generally, they all refer to the same thing.

Terminal vs iTerm

‘iTerm’ is a terminal replacement. It’s simply a program that adds some features for developers and advanced users such as split panes, paste history, and a plethora of others. If you don’t need any of these, you can use the basic terminal just as well. If you’re looking for additional functionality, this might be worth looking into.

Honestly, I tried iTerm and didn’t care too much for it. I prefer TotalTerminal. I don’t have a bunch of needs for extra fancy features, but one thing I do love is the “visor” functionality. From anywhere on my computer, I can have a terminal window slide down from the top of my screen, simply by pressing a keyboard shortcut. This is much easier than navigating to Finder, then Applications, then Utilities, then Terminal. Or even faster than searching for it through Spotlight. Many people use the standard Command/Ctrl + ~ shortcut, but I’ve customized mine to Control + Control.

Another nifty feature is being able to have multiple terminal windows running different processes. I generally have a Jekyll or Grunt server running in one window, and then I use the other window for navigating through folders or committing changes on Git. It works similar to using tabs in Chrome or any other browser.

Basic Commands

Let’s get started. Go ahead and open up a terminal window and play with the following commands. Each command should be entered on a single line, and then followed by the [return/enter] key.

pwd – stands for “print working directory”. It lists the folder that you’re currently in (i.e. /Users/yourusername/Documents)

cd – stands for “change directory”. This lets you move in and out of folders. For example, if you’re in the “Documents” directory and want to move to another directory underneath named “School”, you would type cd School.

cd .. – Move “back” or “up” a folder. In our previous example, this would move you out of the “School” directory and back into the “Documents” folder.

cd ~ – Takes you back to your home directory. Let’s say you’re deep in a folder structure (i.e. /Users/yourusername/Documents/School/Senior/Thesis). Rather than having to type cd .. a billion times, you could type cd ~ to take you back to “/Users/yourusername”.

open . – Opens the current working directory in finder. I use this one ALL the time and love it.

clear – Clears the screen of all text. Sometimes the output of all previous commands can make me claustrophobic. This gives me a fresh, blank screen.

rm [filename] – Deletes a file.

mkdir [directoryname] – Stands for “make directory”. Creates a new folder.

ls – Stands for “list”. Shows a listing of all the files/folders in a directory. Often, I find myself adding an -al flag. -a shows “all files” (hidden files included), and -l shows a long listing of files, rather than in a three-column short listing. This to me, is easier to read. You can combine the two flags together with the ls command by typing ls -al.

sudo [command] – Stands for “super user do”. Sometimes you need elevated privileges to run a certain command. Typing sudo before the command will prompt for your password, and will then run the command. Be careful when using this command. If you don’t know what you’re doing, you can make some unwanted changes. If at all possible, run the command first without sudo, and only add it in if needed.

control + c – Cancels a current process. For example, if you’re running a script, you can kill (cancel) it.

[Up arrow] – You can see a list of all the previous commands you’ve entered by pressing the up arrow key. This saves time rather than having to type in a command over and over again.

[tab] – Autocomplete. Let’s say I have a long folder name such “Discertation”. Start typing the first few letters of the file/folder to distinguish it from other files, and then press the “tab” key. It will autocomplete the filename for you.

Give it a try!

Well, there are a few commands to get you started and make you just dangerous enough. Practice makes perfect! I use most all of these commands on a daily basis, but there are thousands of additional commands that you can learn. Baby steps.


Did I miss any of your favorites? Let me know, and I’ll list them here.

Leave a Reply

Your email address will not be published. Required fields are marked *