# An iTerm2 Cheatsheet

> Source: <https://gist.github.com/squarism/ae3613daf5c01a98ba3a>
> Published: 2015-09-23 17:37:03+00:00

In the below keyboard shortcuts, I use the capital letters for reading clarity but this does not imply shift, if shift is needed, I will say shift. So ⌘ + D does not mean hold shift. ⌘ + Shift + D does of course.
Tabs and Windows
My Favorite Shell Key Combos
These might be helpful to getting you faster with the shell.
These are just common shell shortcuts unrelated to iTerm itelf.
These will usually work in Bash/Zsh/Fish on Mac and on Linux.
There are many shortcuts out there but I use these quite a bit.
There is also more than one way to do a thing so adopt what you like best.
Hopefully some of these improve your work life. :)
Moving Faster
A lot of shell shortcuts work in iterm and it's good to learn these because arrow keys, home/end
keys and Mac equivalents don't always work. For example ⌘ + Left Arrow is usually the same as Home
(go to beginning of current line) but that doesn't work in the shell. Home works in many apps but it
takes you away from the home row.
About keyboard shortcuts 💡
So, some keyboard shortcuts are Mac's. For example fn+Left Arrow is the Home key. On a fullsize Mac keyboard, there is a Home key. Home will usually pass through to iTerm and the shell. By shell, I mean zsh, bash or fish. The shell is the program running inside of iTerm when you open iTerm. If you launch vim or something, zsh/bash/fish is "gone" because vim is running. So, it's complicated to explain when keys work and when they don't.
For example, Home will work in zsh. It will take you to the beginning of the line. If your cursor is at the end of "three" (the cursor is the bar character = |) in this below example:
one two three|
When you press Home (fn+Left Arrow) your cursor will be on one: |one
So, in this way, Home works the same in "the shell" as it does in TextEdit.app or any basic text box on Mac.
This is not the case if you start up vim or emacs. This is not iTerm's fault. This is just how Mac/Linux works. Just a head's up on that little detail.
Copy and Paste with iTerm without using the mouse
I don't use this feature too much. I instead just mouse select (which copies to the clipboard) and paste. There's no need to Copy to the clipboard if you have General > Selection > Copy to pasteboard on selection enabled.
Copy actions goes into the normal system clipboard which you can paste like normal.
Search the Command History
Some of these are not directly related to iTerm and are just "shell features". Like, if you open Terminal.app on Mac some of these still work because it's the shell and not iTerm. I'm including them anyway.
