< !-- Digital window verification 001 -->

A Quick Cheat Sheet to the Unix/Mac Terminal

| Get awesome (and free) stuff here


When it comes to learning how to code, one of the toughest things to learn is the command line.

Not because it’s tough—it’s actually not too difficult. But rather because it is intimidating.

That’s why I put together a cheat sheet of regularly-used commands in the Unix command line (see below).

This isn't meant to be some visually appealing infographic, filled with fancy gradients and sexy charts.

Instead, it has been created to act as a quick reference guide. Moreover, as a way to memorize the basic commands. The only way to ever become comfortable using the command line is to memorize, memorize, and memorize some more.

Luckily, lots of these commands are like their written out name. They have been created to help, not confuse. So, “exit” does in fact mean to exit the terminal.

Take a look below at the Unix commands cheat sheet, perfect for your Mac terminal.

Command Cheat Sheet

Embed this infographic on your site

(If you want to save this for later use, right-click and “Save As“.)

Again, the only way to ever be a successful programmer is to learn how to work in the command line. It's unavoidable.

Start coding now

Stop waiting and start learning! Get my 10 tips on teaching yourself how to code.

Don't worry. I'll never, ever spam you! Powered by ConvertKit

Here are three quick tips to go along with this infographic:

1. SUDO is your friend, but be careful

“Super do” or SUDO is a very powerful command in the terminal. This command overrides the normal security protections that your OS keeps in place to protect the system from modification.

If you know exactly what you’re doing with it, it’s perfectly fine. However, if you make a small mistake, the SUDO command can also mess up system operations on your machine…which can be an interesting way to spend an afternoon.

So it’s important to be careful with what you’re SUDOing. As this Apple Training guide says, always triple-check your typing when using SUDO.

2. Precise Typing makes a Happy OS

Another piece of advice is to use the TAB key to autocomplete terminal commands, if possible. This reduces the amount of typos that can screw up something you’re trying to do, and therefore would have to start typing again. It’s the worst having to type a long list of commands over just because your pinky slipped or something. It’s also convenient because it can save you time by auto-completing.

Also, in most terminals, you can copy/paste commands.

So if you’re really, really nervous about making a mistake, it’s okay to type it out in a notepad or word processor, then paste it into the terminal! There’s no wrong way to enter commands into your terminal, as long as they work properly.

3. Never be afraid to look or ask for help

Oh no! Your commands didn’t work the way they should. It’s not the end of the world, though.

There are tons of communities, wikis, and message boards where someone just like you probably had the same thing happen to them.

So get out of that fetal position, and start searching for some assistance on your command line problem: techies love solving problems. (And if you get really stuck, look to an online service like Codementor.)

No one will look down on you for trying to do something in the terminal, either. Just remember that we all start somewhere, and mistakes are just a part of life. Keep at it, and you’ll be running terminal commands like a pro in no time.

A Quick Note of Caution

Mac is built on Unix, just like all Linux distributions. Even though the command lines are similar, not all commands will behave the same. This is just a matter of experience with whichever OS you’re using and studying its documentation carefully.

Additional Information

Luckily, there’s lots of information available online on command line operations.

Here are a few resources that could be helpful:

Remember: Practice Makes Perfect

Luckily, like learning a foreign language, the more you use it the more you learn it. The best part about this, though, is that you never have to actually speak it aloud. (That was always the hardest part for me when it came to learning a foreign language—speaking it.)

As my programming Bible recommends (Learn Python The Hard Way), make flashcards of the commands and study them until you have memorized every single one.

Of course, also put into practice said commands. Run through the exercises in this command line crash course—basically where I derived all the info for this study guide.

Remember—practice makes perfect.

But even professional programmers make mistakes. So take it easy on yourself, okay?


  • Maryam Labib

    Thanks for this! Very helpful :)

  • Matt Trask

    even as an experienced dev, who is used to working in the terminal and in VM’s, this is helpful just to have at the ready.

  • Tom

    It seems painfully obvious, but the most common word I use in Linux terminal is probably “dir”. Good post.

  • James Chu

    Whilst I think the raw documentation is well researched, the graphics are amazing! If you don’t mind me asking, what did you use to create them?

    • Hey! Thanks :)

      So… I actually built this in Adobe Illustrator. I used a free icon set I found online.

      However — there are a bunch of free/affordable infographic tools online. Some quick Googling will bring back a bunch of results, I’m sure.

      But I typically use Illustrator for stuff like this. Hope this helps!

      • James Chu

        Cool, thanks! :)

  • axiomatiq

    Thanks for this! Another one worth mentioning is using the up/down keys to access a previous command. Huge time saver, especially for fixing typos in long command strings.

  • Pingback: A Quick Cheat Sheet To The UNIX/MAC Terminal by Learn to Code With Me - BSD MAG()

  • Pingback: Unix/Mac OS X Command Cheat Sheet - vd Velde IT Den Haag()

  • ALILI MOHAMED

    Very nice lesson. That’s what I want to learn

  • Pingback: Week 6 Posting – Command Line Cheat Sheets – James Harris Blog()