Skip to main content

Working effectively with iTerm2

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  + [
  • 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


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
Keyboard Shortcut: ⌥→
Action: Send Escape Sequence
Esc+ f
Keyboard Shortcut: ⌘←
Action: Send Escape Sequence
Esc+ [H
Keyboard Shortcut: ⌘→
Action: Send Escape Sequence
Esc+ [F
Keyboard Shortcut: ⌘←Delete
Action: Send Hex Code
0x15
Keyboard Shortcut:⌥←Delete
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

Popular posts from this blog

How to change default calendar for new events in Lightning

https://getsatisfaction.com/mozilla_messaging/topics/how_set_default_calendar_for_new_events_in_lightning Edited version Open Tools > Options > Advanced tab, and click Config Editor button. In the "Filter:" box enter "calendar.registry"  Find a .calendar-main-default key - it will be set to true Other calendars either won't have a .calendar-main-default key (or it will be set to false) Right click on the value of the .calendar-main-default key that goes with the calendar that currently shows up by default in new events to toggle the value to false Click on the .calendar-main-in-composite key that goes with the calendar you want as default Right click on the same key and choose Copy Name from the menu that appears. Now right click on the key again and select New > Boolean Paste the name of the key and Use the backspace key to erase "in-composite" and type "default" Click OK and Choose true and click OK Now exit out of