When it comes to learning how to code, you might be worried about mastering the command line.
- A complete Terminal cheat sheet for everyday use. (from beginners to advanced users). About the Content. Everything you will ever need to know about the terminal and to make use of the command-line interface efficiently. ⇒ In Finder → select the Go menu → use the mac Spotlight → search Terminal.
- The Mac Terminal Commands Cheat Sheet - With so many Mac commands, it’s often difficult to remember and use them all. We’re here to help with a detailed cheat sheet of Mac Terminal commands you can use to unlock enhanced productivity on your system. #Mac #MacBook #macOS #Apple #Terminal #Commands #Guide #CheatSheet.
Get 8 of our most popuplar Cheat Sheets in one handy ZIP! Download Now for Free. We make Tower the best Git client for Mac and Windows. We help over 100,000 users in companies like Apple, Google, Amazon, Twitter, and Facebook to easily & productively work with the Git version control system.
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
(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
Terminal Cheat Sheet Machine
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.
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.
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.
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!
Note: there are affiliate links in this post.
The Terminal on macOS offers quite an amount of functionality, but most of it is hard to discover unless you already know what you’re looking for. So here’s a quick cheat sheet explaining unique functions with their corresponding key combos:
Terminal Cheat Sheet Mac Os
Marks
Marks allow you to mark certain lines in the output, and allow you to jump between different parts of the output.
By default, every time you hit enter on your prompt, Terminal will automatically insert a mark for you. You can configure this in the Edit
menu, under Marks
with the option Automatically Mark Prompt Lines
.
Marks are visualised in the Terminal window as light grey square brackets (They are not, however, part of the output).
Cmd-⬆
: Jump to previous markCmd-⬇
: Jump to next markCmd-Shift-A
: Selects the output between the current marksCmd-Enter
:Enter
, and will always create a markCmd-Shift-Enter
:Enter
, but will never create a markCmd-U
: Create markCmd-Shift-U
: Remove markCmd-L
: Clear screen to previous mark
Bookmarks
Similar to marks, they can optionally be named, and are more useful to denote larger sections of the output. They are denoted by light grey bars.
Cmd-Shift-M
: Insert BookmarkCmd-Option-U
: Mark current line as bookmarkCmd-Shift-Option-M
: Insert named bookmarkCmd-Option-⬆
: Jump to previous bookmarkCmd-Option-⬇
: Jump to next bookmarkCmd-Option-L
: Clear to previous bookmark
Panes
View different parts of the scrollback buffer of the same terminal.
Cmd-D
: Split window into panesCmd-Shift-D
: close split pane
Miscellaneous
Cmd-K
: Clear everythingCmd-Option-K
: Clear scroll back (everything except what you see on the screen)Cmd-Option-O
: Toggle use of option as meta keyCmd-Ctrl-V
: Paste escaped text. Useful for pasting e.g. paths containing whitespace.Cmd-Shift-Option-C
: Copy as plain textCmd-Option-PageUp
orPageDown
: Scroll one line up/downCmd-[
or]
: Switch between windowsCmd-Shift-[
or]
: Switch between tabs
Mac Os Terminal Commands List
(Some of this I learned from mjtsai’s post Mac Terminal Tips, which is a great jumping off point for further interesting things the Terminal can do)