You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
β + backtick (ttrue 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
Basic Moves
Function
Shortcut
Move back one character
Ctrl + B
Move forward one character
Ctrl + F
Delete current character
Ctrl + D
Delete previous word (in shell)
Ctrl + W
Undo
Ctrl + -
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
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
Clear the screen/pane (when ctrl-l won't work) | β + k (I use this all the time)
You can add set -o vi and export EDITOR=vi in your .zshrc (or .bashrc, or what have you). After you source it
(. .~/.zshrc), you are now in vi insert mode. Then you can do:
ESC - to exit the insert mode.
k - to move back in history
j - to move forward in history
/ pattern - to search for a command in the history containing 'pattern'
0 - to move to the beginning of the line
$ - to move to the end of the line
l - move to the right one char at a time
h - move to the left one char at a time
w - to move to the right one word at a time
b - to move to the left one word at a time
cw - to change word
dw - to delete word
C - to change to the end of line
D - to delete to the end of line
... etc ... etc ... you get the point I hope :)
if I want to undo the last text change on the command prompt in iTerm2 Ctrl+_ does not work.
If I try Ctrl+_ in the plain macOS terminal, it works. Am I missing some iTerm2 settings? Thanks!
@jirikrepl Wow. That's a new one. I've never heard of this feature! Amazingly, it's working here like a regular undo. Wow. I'm pressing Ctrl + _ and it works in iTerm2 and Terminal.
Hmm. I don't see any Ctrl based key mappings in iTerm's profile. I was thinking maybe something is remapping. To test that it isn't the shell, maybe you could invoke bash or zsh from iTerm. There's a flag to start the shell without reading your dotfiles too IIRC. Maybe this would help isolate/troubleshoot.
β + 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.
β
I didn't understand that when I navigated to pre/next Mark, the cursor was still in the same position.
@AlanHg I don't know what he meant by that. I use mcfly right now but have used other history searchers in the past. You configure it and then just hit ctrl-r and start typing. Also fish (or zsh) has a thing when you type a command and hit up arrow and it will filter by what you have typed already. So like sudo journalctl<up> would get you all the journalctl commands.
Is there any way to duplicate a tab into a new tab with a keyboard shortcut? I find myself having to ctrl + t to make a new tab, cycle back to the original tab, right click on the tab, and then duplicate it. Catch is that the original tab has to be color coordinated or I'll accidentally delete the duplicated tab. Additionally, you can't duplicate a tab in the right-click context menu unless it's actually in tab form, not window form, which is why I need to make an arbitrary tab in the first place, and at this point I wonder if it would just save more time to manually cd into my desired directory.
EDIT: I have found a workaround, sort of. In the settings, I discovered I can show tabs even when there's only one tab. This will make duplicating them a lot easier, however, I still wasn't able to figure out how shortcuts work. To the docs..
@ralexrdz I had muscle memory in bash for !$ as last argument when I used bash (I still use bash), which will work in every terminal. So, I would use that. It's fast and probably pretty universal. It works in zsh too.
Lately, I use fish (and this is not an endorsement of fish necessarily) and the equivalent in fish is alt + up arrow. π These are shell things, not iTerm2 things, just to be clear. π
@ralexrdzM-. works for me in iTerm2 (3.5) in bash 5.2 and zsh 5.9. Thank you for teaching me a new shortcut π Perhaps you have overridden the default binding somehow (such as with set -o vi). It is yank-last-arg from GNU readline so you'll find it in bash emacs mode, but not in many other shells.
Is there a shortcut to group related tabs together? For example I have a number of services within a parent folder, I'd like to group them for navigation ease. Much like the chrome offering of grouping tabs.
@ralexrdz you can go to iterm settings -> Profiles -> Keys -> General and set Left Option key to Esc+, alt+. and other alt+... keybindings will start working
Is there any way to duplicate a tab into a new tab with a keyboard shortcut? I find myself having to ctrl + t to make a new tab, cycle back to the original tab, right click on the tab, and then duplicate it. Catch is that the original tab has to be color coordinated or I'll accidentally delete the duplicated tab. Additionally, you can't duplicate a tab in the right-click context menu unless it's actually in tab form, not window form, which is why I need to make an arbitrary tab in the first place, and at this point I wonder if it would just save more time to manually cd into my desired directory.
EDIT: I have found a workaround, sort of. In the settings, I discovered I can show tabs even when there's only one tab. This will make duplicating them a lot easier, however, I still wasn't able to figure out how shortcuts work. To the docs..
@Arbyrd33 for each profile you can go into the key bindings and add a new one (Profiles -> {select profile} -> Keys -> "+"), then bind command+t to open a new tab and choose the profile you're currently editing. I did this and now when I press cmd+t it opens the current profile I'm in.
β + 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.
β
I didn't understand that when I navigated to pre/next Mark, the cursor was still in the same position.
so what is the point of navigation?
This isn't really to replace your shell's command history browsing, it is command output browsing. You can navigate to a previous command and see it isolated with its output. You can select it and copy it if you need.
β + oshows a dialog with all profiles and selection of a profile opens tab in specific profile