When it comes to learning how to code, you might be worried about mastering the command line.

Not because it’s hard to learn—it’s actually not too difficult once you start—but rather because it is intimidating. It seems like there's so much you have to know!

That’s why I put together a Unix commands 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, my Unix commands cheat sheet has been created to act as a quick reference guide. You can use it 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.

Embed this infographic on your site

<p><strong>Please include attribution to <g class=”gr_ gr_129 gr-alert gr_spell gr_inline_cards gr_run_anim ContextualSpelling” id=”129″ data-gr-id=”129″>learntocodewith</g>.me when using this graphic.<a href=' https://learntocodewith.me/command-line/unix-command-cheat-sheet/'><img src='https://mk0learntocodew6bl5f.kinstacdn.com/wp-content/uploads/2014/05/command-cheat-sheet.jpg' alt='command cheat sheet' width='818px' border='0'/>

(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.

Disclosure: I’m a proud affiliate for some of the resources mentioned in this article. If you buy a product through my links on this page, I may get a small commission for referring you. Thanks!

Here are four 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, so you don't have to redo your work. 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 saving 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. Use keyboard shortcuts to save time

There are some easy keyboard shortcuts that will help you quickly jump between marks, lines, and pages. Here are a few that will probably become second nature as you work on editing long command strings:

Command + up arrow: jumps to your previous mark Command + down arrow: jumps to your next mark Command + page up: moves up a page Command + page down: moves down a page Option + Command + Page Up: moves up a line Option + Command + Page Down: moves down a line

And that’s only the beginning. Check out Apple’s full list of other terminal keyboard shortcuts to save time navigating around your command string. You’ll become a typo-fixing machine!

Start coding now Stop waiting and start learning! Get my 10 tips on teaching yourself how to code. Success! Now check your email to confirm your subscription.

4. 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.

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.

Start coding now Stop waiting and start learning! Get my 10 tips on teaching yourself how to code. Success! Now check your email to confirm your subscription.

Additional Information

Luckily, there’s lots of information available online on command line operations. Here’s a few resources that could be helpful:

Team Treehouse’s “Console Foundations” will show you how to safely perform common operations in a command line environment, like moving files or installing software.

Lynda.com’s course, “Unix for Mac OS X Users”, goes through all of the workings of the Unix environment as it relates to Mac OS X. This goes a bit further into file permissions and command structuring.

Lastly, a book by Dave Taylor – “Learning Unix for OS X: Going Deep with the Terminal and Shell”. This is a great resource from starting fresh into working with the Unix terminal on your Mac.

Remember: Practice Makes Perfect

Luckily, like learning a foreign language, the more you use the command line, the better you get at it. (The best part is that unlike a foreign language, you never have to actually speak it aloud. That was always the hardest part for me with languages!)

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

Of course, you also should 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.

Start coding now Stop waiting and start learning! Get my 10 tips on teaching yourself how to code. Success! Now check your email to confirm your subscription.

Remember—practice makes perfect.

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

Know someone who would want to learn about using the terminal in their OS? Or could they use a Unix/Mac OS X command reference? Share this Unix commands cheat sheet with them!