How do I clear the scrollback buffer in tmux?

This same question has been plaguing me for quite some time. Here’s the best I’ve come up with. Put this into your .tmux.conf file:

bind -n C-k clear-history

This binds ctrl-k to the tmux clear-history command. The -n after bind makes it so you don’t have to issue the tmux command prefix (ctrl-b by default). I use bash, so ctrl-l already does the equivalent of typing “clear” at the command line. With these two keys I get a nice ctrl-l, ctrl-k combo, which moves all the scroll buffer off the screen (the “clear”) and then deletes all that history (the tmux “clear-history” command).

It’s not quite as nice as Terminal’s, iTerm’s, or Konsole’s 1-key combos for clearing it out, but it’s a world better than typing in clear-history all the time.

Leave a Comment