Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
iterm2 cheatsheet

Tabs and Windows

Function Shortcut
New Tab + T
Close Tab or Window + W (same as many mac apps)
Go to Tab + Number Key (ie: ⌘2 is 2nd tab)
Go to Split Pane by Direction + Option + Arrow Key
Cycle iTerm Windows + backtick (true of all mac apps and works with desktops/mission control)
Splitting
Split Window Vertically (same profile) + D
Split Window Horizontally (same profile) + Shift + D (mnemonic: shift is a wide horizontal key)
Moving
Move a pane with the mouse + Alt + Shift and then drag the pane from anywhere
Fullscreen
Fullscreen + Enter
Maximize a pane + Shift + Enter (use with fullscreen to temp fullscreen a pane!)
Resize Pane Ctrl + + Arrow (given you haven't mapped this to something else)
Less Often Used By Me
Go to Split Pane by Order of Use + ] , + [
Split Window Horizontally (new profile) Option + + H
Split Window Vertically (new profile) Option + + V
Previous Tab + Left Arrow (I usually move by tab number)
Next Tab + Right Arrow
Go to Window + Option + Number

My Favorite Shell Key Combos

These might be helpful to getting you faster with the shell but really this isn't iTerm2 specific. I'm assuming you are using bash or zsh on Mac. There are many tips but I use these quite a bit. There is also more than one way to do it sometimes so adopt what you like best.

Hopefully some of these change your life. :)

Function Shortcut Use
Delete to start of line (favorite) Ctrl + U Use this to start over typing without hitting Ctrl-C
Delete to end of line (favorite) Ctrl + K Use this with command history to repeat commands and changing one thing at the end!
Repeat last command Up Arrow Cycle and browse your history with up and down. Ctrl-R is faster if you know the string you are looking for.
Move back and forth on a line Arrow Keys This takes you off the home row but it's easy to remember
Move back and forth on a line by words + Arrow Keys Fast way to jump to a word to correct a typo or "run again" with minor changes
Delete previous word (in shell) Ctrl + W It's faster to delete by words. Especially when your last command was wrong by a single typo or something.
Clear screen Ctrl + L This is telling the shell to do it. When this doesn't work + K will tell iTerm to do it which works when you aren't in a shell. Use this instead of typing clear over and over.

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.

Function Shortcut
Move to the start of line Ctrl + A or Home
Move to the end of line Ctrl + E or End
Move forward a word Option + F
Move backward a word Option + B
Set Mark + M
Jump to Mark + J
Moving by word on a line (this is a shell thing but passes through fine) Ctrl + Left/Right Arrow
Cursor Jump with Mouse (shell and vim - might depend on config) Option + Left Click

Copy and Paste with iTerm without using the mouse

I don't use this feature too much.

Function Shortcut
Enter Copy Mode Shift + + C
Enter Character Selection Mode in Copy Mode Ctrl + V
Move cursor in Copy Mode HJKL vim motions or arrow keys
Copy text in Copy Mode Ctrl + K

Copy actions goes into the normal system clipboard which you can paste like normal.

Search the Command History

Function Shortcut
Search as you type Ctrl + R and type the search term; Repeat Ctrl + R to loop through result
Search the last remembered search term Ctrl + R twice
End the search at current history entry Ctrl + Y
Cancel the search and restore original line Ctrl + G

Misc

Function Shortcut
Clear the screen/pane (when Ctrl + L won't work) + K (I use this all the time)
Broadcast command to all panes in window (nice when needed!) + Alt + I (again to toggle)
Find Cursor + / or use a theme or cursor shape that is easy to see
@nmacafee

This comment has been minimized.

Copy link

nmacafee commented Oct 26, 2017

Thank you. As a new iTerm user this is very helpful.

@DarkMukke

This comment has been minimized.

Copy link

DarkMukke commented Nov 3, 2017

You are missing ⌘ + Shift + i to input across all tabs and Ctrl + l to clear the window

@inevity

This comment has been minimized.

Copy link

inevity commented Jan 4, 2018

why denied?

@bhochhi

This comment has been minimized.

Copy link

bhochhi commented Feb 13, 2018

Thanks!! One more: ctrl + ⌘ + Arrow for resizing active pane.

@ardinusawan

This comment has been minimized.

Copy link

ardinusawan commented Mar 9, 2018

Can iTerm2 Fullscreen in split terminal?

@jcaffrey

This comment has been minimized.

Copy link

jcaffrey commented Mar 23, 2018

option + f and option + b doesn't work if you don't set your option key in preferences > keys

@paraggit

This comment has been minimized.

Copy link

paraggit commented Apr 3, 2018

can we fire command at a time in multiple windows?

@rajpootmohan

This comment has been minimized.

Copy link

rajpootmohan commented Apr 6, 2018

paraggit .... you can do in multiple tabs using ⌘ + Shift + i . Not sure about multiple windows.

@paulb777

This comment has been minimized.

Copy link

paulb777 commented Aug 22, 2018

Is there anyway to clear the output of the previous command?

@jaredpavan

This comment has been minimized.

Copy link

jaredpavan commented Aug 24, 2018

On my last laptop I used to be able to press Ctrl + s to do a forward search in the case that I pressed Ctrl + r one too many times and need to search forward once or twice. Is there a config that I need to change to restore this functionality?

@Dawqss

This comment has been minimized.

Copy link

Dawqss commented Sep 7, 2018

Good Job

@Jonathan-UIUC

This comment has been minimized.

Copy link

Jonathan-UIUC commented Sep 27, 2018

I find it might be useful to add "Cmd + w" to close the split window in the cheatsheet:)

@squarism

This comment has been minimized.

Copy link
Owner Author

squarism commented Oct 31, 2018

Oh man, this blew up and gists don't notify on updates. I will incorporate the suggestions. But Cmd+w is pretty global on mac @Jonathan-UIUC :)

@ngtrieuvi92news

This comment has been minimized.

Copy link

ngtrieuvi92news commented Nov 25, 2018

thanks, nice job

@moonD4rk

This comment has been minimized.

Copy link

moonD4rk commented Jan 2, 2019

Option + Left mouse click to move cursor easily.

@tshu-w

This comment has been minimized.

Copy link

tshu-w commented Jan 17, 2019

Broadcast command to all panes in window help a lot! thx

@Manish3323

This comment has been minimized.

Copy link

Manish3323 commented Mar 24, 2019

cmd + / to focus where the cursor. helpful when multiple applications are on opened on one desktop. also when split screens are used.

@gmaghera

This comment has been minimized.

Copy link

gmaghera commented May 20, 2019

⌘ + Shift + arrow-up
⌘ + Shift + arrow-down

For navigating marks. If shell integration is enabled all commands are marked automatically, and you can quickly go to previous commands and their output.

@simonewebdesign

This comment has been minimized.

Copy link

simonewebdesign commented Jun 10, 2019

The undo doesn't seem to be correct?

@squarism

This comment has been minimized.

Copy link
Owner Author

squarism commented Jun 10, 2019

The undo doesn't seem to be correct?

Fixed! Thanks @simonewebdesign .

@jianl9

This comment has been minimized.

Copy link

jianl9 commented Jun 23, 2019

why does some of the hotkeys not work for me? Do I need to arrange it or it come with the app?

@korniychuk

This comment has been minimized.

Copy link

korniychuk commented Aug 23, 2019

Awesome!

@rickgaurav

This comment has been minimized.

Copy link

rickgaurav commented Sep 27, 2019

For Moving forward/backward by words, Use Option + F/B. It might need you to reset your keys, Preferences => Choose the profile => Keys Tab => Set Left Option Key and Right Option key to Esc+

@RichardBronosky

This comment has been minimized.

Copy link

RichardBronosky commented Oct 25, 2019

@jaredpavan said:

On my last laptop I used to be able to press Ctrl + s to do a forward search in the case that I pressed Ctrl + r one too many times and need to search forward once or twice. Is there a config that I need to change to restore this functionality?

I had the same issue. I found your comment here by Googling for the solution. So, I want to make sure it is here for others. Since iTerm uses TMUX and TMUX ignores "flow control" commands, Ctrl + s is ignored. The solution is to call stty -ixon in your shell session. If you put it in your .bash_profile it will fix it for all login shells.

@jaredpavan

This comment has been minimized.

Copy link

jaredpavan commented Oct 25, 2019

@rickgaurav Thank you! This has been bothering me for months and that worked!

For Moving forward/backward by words, Use Option + F/B. It might need you to reset your keys, Preferences => Choose the profile => Keys Tab => Set Left Option Key and Right Option key to Esc+

@RichardBronosky - interesting. My iTerm doesn't have tmux.

@cagricolak

This comment has been minimized.

Copy link

cagricolak commented Nov 28, 2019

Thank you

@AntonioArts

This comment has been minimized.

Copy link

AntonioArts commented Dec 29, 2019

Very handy, thank you!

@zandegran

This comment has been minimized.

Copy link

zandegran commented Feb 6, 2020

⌘ + Shift + arrow-up
⌘ + Shift + arrow-down

For navigating marks. If shell integration is enabled all commands are marked automatically, and you can quickly go to previous commands and their output.

@emreac

This comment has been minimized.

Copy link

emreac commented Mar 11, 2020

Thank you!

@AlaaHamoudah

This comment has been minimized.

Copy link

AlaaHamoudah commented Mar 16, 2020

I am new to iTerm and I am so used to move between words using the option and the arrow, it's not working here and also the ctrl + arrows is not working as well

@squarism

This comment has been minimized.

Copy link
Owner Author

squarism commented Mar 19, 2020

I am new to iTerm and I am so used to move between words using the option and the arrow, it's not working here and also the ctrl + arrows is not working as well

@AlaaHamoudah
Thanks, the correct modifier key is ⌥ (option). I edited this gist. Check Preferences > Profiles > Keys that your left option key is set to Esc+.
Edit: Preferences > Profiles > Keys
See screenshot below. Thank you @SlowerLoris

@AlaaHamoudah

This comment has been minimized.

Copy link

AlaaHamoudah commented Mar 19, 2020

Thanks for ur response, but still not clear for me. Here are my keys, the left option is not set to anything, and there is no Esc+ in the dropdown list.
Also, I am used on the right option to work with the arrows as the normal shell, not the left one. Is this doable here?
Screen Shot 2020-03-19 at 8 34 49 AM

@SlowerLoris

This comment has been minimized.

Copy link

SlowerLoris commented Mar 23, 2020

@AlaaHamoudah Go to Profiles tab ( not Keys ), you will see this:
Screenshot 2020-03-23 at 09 06 20

@yuchdev

This comment has been minimized.

Copy link

yuchdev commented Apr 30, 2020

Ctrl + D
closes panel which you split by ⌘ + D

@squarism

This comment has been minimized.

Copy link
Owner Author

squarism commented Apr 30, 2020

@yuchdev Ctrl-D is a common unix convention. It's not related to iterm but you are not wrong. 😄 It's a shortcut for EOF which is the same thing as typing exit but it's also useful for cat and other shell tricks. ⌘+W is a closer accompanying shortcut for ⌘+D because it closes a window, if it is a pane, it will close that pane.

@gaochundong

This comment has been minimized.

Copy link

gaochundong commented Jul 1, 2020

Thanks

@akki

This comment has been minimized.

Copy link

akki commented Jul 6, 2020

Thanks @SlowerLoris , that worked for me ❤️

@decpdx584

This comment has been minimized.

Copy link

decpdx584 commented Jul 22, 2020

Thanks so much for this, @squarism ! I'm a new developing student and this will really help me out.

@ronakzala

This comment has been minimized.

Copy link

ronakzala commented Jul 24, 2020

Thank you so much for this curated list of shortcuts!

@PropeReferio

This comment has been minimized.

Copy link

PropeReferio commented Aug 9, 2020

Loving iTerm2 in general.
I'd like to be able to skip words in the terminal with Option + Left Arrow/Right Arrow, but it's currently only working with Option +F/B. I set the left option key to Esc+ already.

How can I configure such that the arrow keys work? Thanks.

@squarism

This comment has been minimized.

Copy link
Owner Author

squarism commented Aug 12, 2020

Loving iTerm2 in general.
I'd like to be able to skip words in the terminal with Option + Left Arrow/Right Arrow, but it's currently only working with Option +F/B. I set the left option key to Esc+ already.

How can I configure such that the arrow keys work? Thanks.

@PropeReferio Ctrl+Arrow keys might work for you. It seems to work on Mac locally and a remote ssh Linux shell. I think that's just a terminal thing and not anything iTerm is messing with. I know Putty/Windows seems to handle this ok. So Ctrl+Arrow keys will jump by words on a current line of a shell. Useful for editing history or some really long command. 🌻

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.