Settings
Launch iTerm, open iTerm > Preferences or just⌘ + ,
.Hotkey to toggle iTerm2
Under Keys tab, in Hotkey section, enable “Show/hide iTerm2 with a system-wide hotkey” and input your hotkey combination, e.g. I use
Alt + Space
.Shortcut Keys
Tab navigation
- open new tab
⌘ + t
- next tab
⌘ + Shift + ]
- previous tab
⌘ + Shift + [
Pane navigation
- split pane left-right
⌘ + d
- split pane top-bottom
⌘ + Shift + d
- next pane
⌘ + ]
- previous pane
⌘ + [
Search
- open search bar
⌘ + f
- find next
⌘ + g
Input to all panes
- input to all panes in current tab
⌘ + Alt + i
Clear screen
- clear buffer
⌘ + k
- clear lines (Bash command)
Ctrl + l
Zooming / Font Resize
- toggle maximize window
⌘ + Alt + =
- toggle full screen
⌘ + Enter
- make font larger
⌘ + +
- make font smaller
⌘ + -
Find Cursor
- highlight cursor
⌘ + /
thanks http://teohm.com/blog/working-effectively-with-iterm2/
Making iTerm 2 work with normal Mac OSX keyboard shortcuts
![](https://i1.wp.com/elweb.co/wp-content/uploads/2012/10/iterm-screenshot.png?fit=825%2C320&ssl=1)
Today I found out how to map common Mac keyboard shortcuts to work like they should inside iTerm. The ones that I needed most where ⌥← (Option-Left Arrow) to move left one word, ⌥→ (Option-Right Arrow) to move right one word, ⌘← (Command-Left Arrow) to move to the beginning of the line and ⌘→ (Command-Right Arrow) to move to the end of the line.
The process is very simple, you just have to add a few shortcut keys to your profile. Here are the screenshots.
Keyboard Shortcut: ⌥←
Action: Send Escape Sequence
Esc+ b
Action: Send Escape Sequence
Esc+ b
Keyboard Shortcut: ⌥→
Action: Send Escape Sequence
Esc+ f
Action: Send Escape Sequence
Esc+ f
Keyboard Shortcut: ⌘←
Action: Send Escape Sequence
Esc+ [H
Action: Send Escape Sequence
Esc+ [H
Keyboard Shortcut: ⌘→
Action: Send Escape Sequence
Esc+ [F
Action: Send Escape Sequence
Esc+ [F
Keyboard Shortcut: ⌘←Delete
Action: Send Hex Code
0x15
Action: Send Hex Code
0x15
Keyboard Shortcut:⌥←Delete
Action: Send Hex Code
0x1B 0x08
Action: Send Hex Code
0x1B 0x08
thanks https://elweb.co/making-iterm-2-work-with-normal-mac-osx-keyboard-shortcuts/
Why doesn't secure copy/automatic profile switching work?
Some features of iTerm2 depend on the terminal knowing the hostname you are connected to.
Secure Copy
The secure copy feature in iTerm2 is invoked by right-clicking on a filename while ssh'ed to a remote host and selecting Download with scp from hostname. It is also invoked by dragging a file onto the terminal while holding option and dropping it into a part of the terminal after a shell prompt of the remote host appears.
Is shell integration installed?
If you see a blue arrow in the margin to the left of your prompt on the remote host you can skip this question.
echo $ITERM_SHELL_INTEGRATION_INSTALLED
Yes
Did we guess your hostname correctly?
The shell integration script currently uses the hostname -f command to guess your hostname. There are various ways this can go wrong: if you use mDNS, if you don't have DNS, if your host is multihomed, if your machine doesn't have the hostname command installed, and so on.
It doesn't work when I'm root
You have to install shell integration in root's login script, too. I bet you don't like that idea.
BUT ROOT USE SH not BASH
https://gitlab.com/gnachman/iterm2/wikis/scp-not-connecting
Another way to execute an interactive shell as the superuser is
sudo -s
, which uses $SHELL
as the shell.
As the comments in the other answer mentioned,
su -s /path/to/bash
doesn't work in OS X.
OS X doesn't support changing login shells in
/etc/passwd
either, but you can use dscl
:$ dscl . -read /Users/root UserShell
/bin/sh
$ sudo dscl . -change /Users/root UserShell /bin/sh /bin/bash
$ dscl . -read /Users/root UserShell
/bin/bash
https://superuser.com/questions/626391/change-the-sudo-su-shell
now run
$ su
# curl -L https://iterm2.com/misc/install_shell_integration_and_utilities.sh | bash
Comments