127
votes
Accepted
iTerm2 (version 3): Individual history per tab?
If you are using zsh, append these two lines to ~/.zshrc after line source $ZSH/oh-my-zsh.sh
unsetopt inc_append_history
unsetopt share_history
From
zshoptions(1) - Linux man page :
...
110
votes
How can I get control+left arrow to go back one word in iTerm2?
Working solution for zsh. Simple, straightforward, out-of-the-box.
Goto:
⌘, Preferences → Profiles → Keys → Keyboard Behavior
Load Preset: Natural Text Editing
68
votes
Accepted
Disable autocomplete hints on iTerm2
You can disable the auto command completion by navigating to the following menu:
View > Auto command completion
66
votes
iTerm 2 window resizing
I finally got the answer!
ref:
https://gitlab.com/gnachman/iterm2/issues/3375
Go to the following menu option:
Preferences - Advanced - Windows - Terminal Windows resize smoothly - Yes
Holding ...
66
votes
Accepted
How can I prevent the iTerm2 hotkey window from losing focus?
(If anyone wants the answer as of October 2017)
For iTerm2 as of v3.1.3:
Open the iTerm Preferences window (Menu bar: iTerm2 > Preferences...) and select Profiles.
Select the Hotkey Window profile* ...
53
votes
Accepted
How do I disable the beep/bell sound in iTerm2 in macbook?
To disable the bell sound in iTerm2, do this:
iTerm2 -> Preferences -> Profiles
Under Terminal tab, you will see Notifications header. Toggle the Silence bell option.
EDIT: Please note that ...
51
votes
Is there a keyboard shortcut to alternate between color schemes in iTerm2
This works on iTerm2 (version, 3.0.8 through 3.0.13)
In iTerm's preferences, select the keys tab.
There's a table called key mappings
click on the + at the bottom of the table
Choose a keyboard ...
47
votes
Accepted
Zsh prompt with current working directory
See the EXPANSION OF PROMPT SEQUENCES and SIMPLE PROMPT ESCAPES sections of the zsh manual page at man zshmisc.
This prompt string, PS1='%m %1d$ ', displays the machine name (%m) and the trailing ...
47
votes
Accepted
Copy the output of the last command in iTerm2
I figured out the solution:
Install Shell Integration: iTerm2 > Install Shell Integration
Restart iTerm2 (or just source the script)
Run some command that produces output, e.g. pwd
Verify that ...
42
votes
Accepted
Pasting 'required text' into terminal emulator results in '^[[200~required text~'
These characters are used for bracketed paste mode. Some terminal-based programs enable this mode so that they could distinguish pasted text from directly typed text.
For example, text editors ...
36
votes
Where is the .zshrc file on Mac?
The .zshrc file is not present by default in macOS Catalina, we need to create it.
Steps for creation:
Open Terminal
Type touch ~/.zshrc to create the respective file. (touch command will create the ....
36
votes
Zsh prompt with current working directory
The best version of the combinations that works for me is this:
PS1='%n@%m %~$ '
%n is the user logged in
%m is the machine name
%~ gives the path relative to HOME, if path begins with HOME.
This is ...
34
votes
Enter key prints ^M in certain situations in iTerm
This problem occurs because of the odd or old terminal line settings. The stty tool on Unix can help you reset them.
I have had the same issue on Iterm2 on Mac and got it fixed using it.
stty sane
...
30
votes
With Bash + iTerm2, how to name tabs?
I used solutions similar to the above for quite a while, but I use enough tabs that I also want them color-coded for easy visual reference. So I whipped up tabset, a utility to set the tab title, ...
28
votes
Accepted
Is it possible to use vim key bindings in iterm2?
I'm surprised you haven't yet found out about
set -o vi
This enables the vi editing mode in Bash (to make this permanent put the command in your ~/.bashrc file). Greg's Wiki has a short summary, and ...
27
votes
Increase/Decrease Font Size in iTerm2
In the current iTerm2 (version 3.3.7), there's View > Size Changes Update Profile which solves the issue:
To change the font size regardless of profile, see this iTerm2 issue where a script is ...
26
votes
How to automatically restore window arrangement from last time in iTerm?
In 2019 (iTerm v3.2.9), what works for me is:
Save your current arrangement by clicking CMD + shift + S (or go Window -> Save Window Arrangement.
Now go to iTerm2 -> Preferences -> ...
25
votes
Accepted
Is there any way to set the default font to 16pts in iTerm2?
You can also add custom values for font sizes. From the Font window, click the gear in the upper left, and choose "Edit Sizes".
Then, enter your value.
24
votes
ALT+arrow moving between words in zsh and iTerm2
What worked best for me in regards to making iTerm2's command line navigation more intuitive for me (I am a young adult who didn't grow up on a command line, but I've spent a lot of time in text ...
24
votes
iTerm command click to open with Atom
(I use this one. For some reason the iTerm option "Open with default app" doesn't work, but the command "$ open whatever" works like a charm, so I've just set that command.
21
votes
How can I get control+left arrow to go back one word in iTerm2?
I fixed it this way:
In top menu; go to
Profiles
-> Open profiles...
-> Edit profiles... (button)
-> Keys (tab)
-> Load Preset... (dropdown)
-> Choose "Natural text editing&...
20
votes
Accepted
Select full word in iTerm2 using alt + shift + arrow
Go to Preferences then Keys.
Press the +.
For the Keyboard Shortcut, press Alt + Shift + ← | →
For Alt + Shift + ←, choose "Move Start of Selection Back" and "Move by Word".
For ...
20
votes
Accepted
How do I move a split pane to a new tab in iterm?
Hold CMD-SHIFT-OPT and drag the pane
New Tab -> to the tab bar of a terminal window
New Window -> away from the terminal window
Source: https://groups.google.com/d/msg/iterm2-discuss/kg_5b3EKCpM/c-...
16
votes
iTerm2 (version 3): Individual history per tab?
Extra info to the perfect answer of harrymc.
This is not Iterm2 but a feature of zsh which gets activated by default if you use oh-my-zsh
(see: https://github.com/robbyrussell/oh-my-zsh/blob/master/...
15
votes
How to make command+arrow go to begining and end of line in iterm2?
I would say mapping keys manually, as shown in other answers, is an advanced setup. iterm2 already has preset for that.
Open Preferences
Click "Profile" tab
Select a profile in the list ...
14
votes
iTerm2 Background image and split panes
Since iTerm version 3.3.0 (in Beta as of June 2019) you have a setting for this:
In Preferences > Appearance > Panes un-tick Separate background images per pane
13
votes
iTerm2 shows up on every Space. How to keep it from doing so?
I've been having the absolute opposite problem of this post. I've rebooted and my iterm settings have the hotkey window set to every space. Anyone else encountering that?
edit: It turns out I needed ...
13
votes
Accepted
Create SIGINT (Signal Interrupt) Shortcut for iTerm2
Preferences » Keys » Key Bindings
click +
Action: Send Hex Code
enter 0x03
12
votes
Remote server, iTerm2, and tmux integration
TLDR
ssh <hostname> -t 'tmux -CC new -A -s tmssh'
Explanation
Inside an existing ssh session (assuming you are using iTerm2), you can simply run tmux -CC and a native iTerm2 window will open ...
12
votes
Custom iTerm appearance doesn't save after quitting iTerm
You have to save the settings to your profile on the General tab.
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
iterm2 × 361macos × 171
terminal × 135
zsh × 55
tmux × 47
iterm × 39
bash × 35
vim × 32
mac × 26
keyboard-shortcuts × 25
ssh × 19
terminal.app × 17
shell × 16
oh-my-zsh × 16
command-line × 15
colors × 13
keyboard × 11
linux × 10
emacs × 8
fish × 8
osx-lion × 7
scrolling × 7
applescript × 7
fonts × 6
key-binding × 6