Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

When I use the terminal in OSX, I frequently use +K to clear the screen and scrollback buffer. It's deep in muscle memory.

I've started tinkering with tmux, and one gripe is that +K wipes the whole screen, panes and all. What I'd like is for it to affect only the focused pane.

Can I somehow configure this behavior?

share|improve this question

You can use prefix+r, after the +K, to redraw the tmux window.

If you can break the habit, a normal ctrl+l works normally per pane.

share|improve this answer
ctrl+l is not the same as cmd+k because you can still scroll up and see old history with ctrl+l. If you're tailing a log for example that quickly fills your scroll back cmd+k is invaluable because you know exactly when you last left off. ctrl+l will not do this for you. – Bjorn Tipling Jun 3 '14 at 15:44
@BjornTipling ⌘+K is a feature of the terminal emulator, and will not work inside tmux... this binding is designed to wipe the static stdout, which is not how tmux ,and other programs like vim/emacs/weechat/mutt, are being displayed. – demure Jul 4 '14 at 23:18
+1 for breaking the habit, I can't stop doing it until today. The best thing is to type clear instead I guess – zanona Nov 21 '14 at 16:11

Configure iTerm2 to send clear command

Preferences -> Keys -> + (add new global shortcut)

  • Keyboard shortcut: ⌘+k
  • Action: Send text
  • value:


share|improve this answer
Simple and elegant solution. Thank you, my friend. – Rafael Rinaldi Mar 18 at 3:37
Beautiful solution! You've made my tmux experience far more enjoyable. Thank you :) – Matt Darby Jun 2 at 2:54
Just a warning, this will flash the text to the terminal – Wade Jun 21 at 20:13

You can add the following lines in your .tmux.conf:

# clear the current pane
bind -n C-k send-keys C-l \; clear-history

Then reload your tmux config. Now you can use your bind key +k (e.g.: Ctrl+b,k) to clear the current pane.

I don't know the syntax for OSX but I guess you can easily adapt the line.

share|improve this answer
I see that C-l clears the screen and clear-history clears the scrollback buffer. What does the \; part do? – Nathan Long Feb 18 at 11:58
it runs both @NathanLong – Wade Jun 21 at 20:08

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .