38

In Ubuntu, I want to scroll up while a command is running in my terminal window and generates new output (the command that is running is rspec). I can scroll up, but each time rspec generates a new line of console output, it throws me back down to the bottom. Is there a way to scroll all the way up? I'm using terminator on Linux Mint/Ubuntu 12.04 LTS.

I found a possible workaround. Terminator homepage says that with

stty ixon

you can turn on "XON/XOFF flow control for terminal output. Being able to pause output by typing ^S and resume it by typing ^Q [...]"

This it not totally what I wanted though, without having to pause the output (and maybe wondering when forgetting to turn it on again), I thought there might be a simple modifier key like shft-alt with mouse wheel scroll-up. Are there better solutions?

6
  • That's one thing that I really like about LXTerminal (LXDE). Jan 24, 2013 at 14:37
  • Are you scrolling by Shift-PgUp or by scrollbar?
    – ott--
    Jan 24, 2013 at 15:25
  • @MatthewLundberg Normally with mouse scroll wheel, so scrollbar. But it also doesn't work with shift-pgup :( Can I have lxterminal inside of terminator as well, do you know?
    – Yo Ludke
    Jan 24, 2013 at 15:33
  • 1
    xfce4-terminal has an option called Scroll on output that you can uncheck and does just what you asked.
    – lmcanavals
    Jan 24, 2013 at 16:16
  • 1
    As a workaround, you could send the output to a file, open another terminal and tail -f file.txt to see it as it is generated. That would leave your 1st terminal free to scroll back and still let you watch the output in realtime. Not elegant I know.
    – terdon
    Jan 24, 2013 at 17:43

2 Answers 2

55

Although I'm a bit late, I'm posting this here so that anyone who comes here gets a solution. For me, the solution to the same problem was:

Terminator preferences -> Profiles Tab -> Scrolling [sub]tab -> Uncheck 'Scroll on output' option.

The good thing about this option, is that it will still scroll on output when you are at the very bottom of the output, but as soon as you scroll up, it will stop and won't bother you even if output content is still being generated.

I hope this helps

3
  • cool :) Is it possible to create a shortcut to toggle this option?
    – Yo Ludke
    Apr 5, 2013 at 8:14
  • 1
    I've searched a bit, but haven't found any way to toggle it with a shortcut within terminator. However, as the option is written in the terminator config file at "$HOME/.config/terminator/config", it should be possible to assign a global shortcut to a command that toggles the option on and off directly in the config file.
    – Chikitulfo
    Apr 6, 2013 at 11:13
  • 4
    Still, making that change to the config file won't affect already running terminator instances, but rather it will only affect new terminator instances launched after the edit. So if you want to toggle it on a running terminator, you have to do it manually, afaik. In any case, with the option toggled to false, as soon as you scroll down to the last line, it continues auto scrolling on output. It only stops autoscrolling if you manually scroll up. So I don't see any real need to toggle the option on and off.
    – Chikitulfo
    Apr 6, 2013 at 11:29
2

tail -f log.txt | less will update to advance to the new information, and you can then go up or down. You can also use less search features and so on. With the pipe method, you can also parse the moving output.

And the same idea, but without the pipe : less +F log.txt .
(This assumes you can work with your content in this fashion.)

The old Unix way was to hit Ctrl-S in your terminal to stop, and Ctrl-Q to restart output scrolling -- this is basically what terminator is letting you do with stty ixon.
With scrollbars added, this seems pretty decent to me -- hit Control-S, scroll up to whatever you like, and then Control-Q to go back down. Yes, you will occasionally forget to unpause the output.

Because I'm exceptionally lazy, and because I like the flexibility of output redirection, I'd use tail -f with the pipe (assuming that fits the case) . Then I can stop it, arrow-up and add something like a grep, and it still runs: tail -f tac_plus.log | less | egrep 'peerip'

Throw some cats and tee in there and you have a real party.

2
  • I wanted to use this for rspec spec's - The problem is, with the tail/less approaches, the colors get lost (the output is black and white instead of green/red if I run the command directly)
    – Yo Ludke
    Jan 31, 2013 at 9:19
  • @YoLudke I'm not familiar with rspec or how it does colorizing. There are ways to pass colors through grep, etc., but that might not work here. Are you doing something like running pointing rspec to a persistent/looping/long-running process, and getting your output from that?
    – belacqua
    Jan 31, 2013 at 17:58

You must log in to answer this question.

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