Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.0k views
in Technique[技术] by (71.8m points)

terminal - How can I clear scrollback buffer in Tmux?

FYI, I am using Tmux through the Mac OS X Terminal app.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...