19

Usually tmux will only show as much output as however many rows my terminal currently displays. And then when I detach it, it clears all of its content. I know how to look at scrollback (ctrl+A, [, k, ...), but how can I configure tmux to just print all its output to terminal, as if I wasn't using it at all?

I like tmux because I'm awful at remembering to nohup certain tasks, and because it makes viewing the output of long-running jobs easier. But I would like to be able to view its scrollback more naturally, by simply scrolling back in iTerm2.

Alternatively, if there's a way to do this in screen, I can use that too.

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
chbrown
  • 11,865
  • 2
  • 52
  • 60
  • 1
    Mark, that question is aptly titled "How do I scroll in tmux." I know how to scroll in tmux. In my question I said I knew how to scroll in tmux. I don't see which of the answers to that question address my problem of retaining tmux buffer in my terminal. – chbrown Mar 11 '13 at 00:38

4 Answers4

39

iTerm2 build 1.0.0.20130302 has an preference which enables it to capture scrollback even when a so-called hard status line is present:

iTerm2 preferences pane

Works for me, tested with tmux v1.8.

RobM
  • 8,373
  • 3
  • 45
  • 37
  • That option checked solved my prominent problem/thought to stick around with tmux. Great. Now I'll stick to tmux one more time. – millisami Apr 27 '13 at 17:32
  • Well it worked for the window but it doesn't work for Panes. Is there any option to get this same feature? – millisami Apr 30 '13 at 15:41
  • FYI this seems to work with `screen` and `hardstatus on` also, thanks! – matt b Jun 19 '13 at 17:06
7

I stumbled across an alternative solution on Superuser.com: Use terminal scrollbar with tmux. Add this to your ~/.tmux.conf:

# Pretend our terminal doesn't support alternative screens, and thus all text 
# should be placed into the scrollback buffer when it goes off the top of the 
# screen.
#
# https://superuser.com/questions/310251/use-terminal-scrollbar-with-tmux
set-option -ga terminal-overrides ',xterm*:smcup@:rmcup@'

Works for me with gnome-terminal v3.4.1.1 and tmux v1.9

Community
  • 1
  • 1
RobM
  • 8,373
  • 3
  • 45
  • 37
  • This works great for me too. I also needed to add `set-window-option -g mouse-mode off` to my `.tmux.conf`. – Ben Jan 07 '14 at 19:38
  • @Ben You probably mean `mode-mouse`, not `mouse-mode`. Your suggestion results in `unknown option: mouse-mode` on my system. – Steven K Sep 23 '14 at 22:41
3

Add this to your ~/.tmux.conf and you will be able to enter copy mode just by scrolling:

setw -g mode-mouse on

You may also want to enable other mouse features:

set -g mouse-resize-pane on
set -g mouse-select-pane on
set -g mouse-select-window on

See this excellent write-up of these features: http://tangledhelix.com/blog/2012/07/16/tmux-and-mouse-mode/

RobM
  • 8,373
  • 3
  • 45
  • 37
2

In my case, just putting set-option -g status off in .tmux.conf allows to leave the scrollback in the terminal. But you lose the status bar.

Sir Crispalot
  • 4,792
  • 1
  • 39
  • 64
nico S
  • 81
  • 4