Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I was running scripts overnight from the command line (inside Screen on a Linux EC2 instance) and some errors that I was not tracking occurred. I want to "scroll up" or view more of the history in Screen, but I cannot seem to find any commands that will work.

I need to see the onscreen output "further up" than I can on my current screen. CTRL + a is supposed to put me into scroll mode inside Screen, but it's not working.

share|improve this question

migrated from stackoverflow.com Jun 28 '11 at 20:59

This question came from our site for professional and enthusiast programmers.

    
history | less, more? Or you are asking how to keep more history? –  khachik Jun 28 '11 at 19:47
    
history will keep only commands have been fired in shell. He is more asking about logging sort of stuff –  Rahul Jun 28 '11 at 19:49
    
<Shift> + <PgUp> is the only option. And it has some limit as well (at most last 500 lines, I guess). –  ssapkota Jun 28 '11 at 19:51
    
I need to see the onscreen output "further up" than I can on my current screen. CTRL + a is supposed to put me into scroll mode inside Screen, but it's not working for me. –  T. Brian Jones Jun 28 '11 at 19:52
    
Just Ctrl-a is screen's escape. The whole key sequence to enter scrollback mode would be Ctrl-a [, as opyate says. Ctrl-a ESC also works for me, I don't remember which one is standard / commonly used. –  ninjalj Jun 28 '11 at 20:01

4 Answers 4

up vote 11 down vote accepted

When you start screen you can specify the size of the scrollback buffer with -h, so you can increase it from the default of 100 lines. However, with a currently running screen, once the data has left the buffer, it is gone.

share|improve this answer

Assuming you haven't overriden your escape sequence, you can press Ctrl-a [ to go into scrollback mode, then use the usual Page-UP/Page-DOWN or Ctrl-b/Ctrl-f to go up and down.

From the Gentoo wiki on Screen usage

share|improve this answer
    
and ESC to exit scrollback mode, IIRC –  ninjalj Jun 28 '11 at 19:58

You can also run your commands in the script command which will log the output to disk. Or you can: command 2>&1 | tee /tmp/cmd.out to log the output for future investigation in you wanted a (practically) infinite sized output history.

share|improve this answer
    
this is what I ended up using for my task. Works great. Thanks. –  T. Brian Jones Jun 28 '11 at 21:59

Depending on what terminal program you are using, you can usually change the Scrolling Buffer under Settings. I know for xterm you have to enable Scrolling first, then you can set the buffer to infinite.

Your best bet however for logging scripts would be to Re-direct the standard output to a file:

ScriptName >> OutputFile.txt

Doing it this way you can scroll and search freely as well as keep a record (i.e. in case your computer crashes).

EDIT: This is close to the piping solution above, however redirecting standard input can be useful in other instances as well:

grep linux stackoverflow.txt > linuxquestions.txt

or

cat linuxquestions.txt | grep buffersize > bufferquestions.txt
share|improve this answer
    
Do note that screen(1) doesn't allow terminal scrolling. That's both one of its main features and one of its main drawbacks. –  sarnold Jun 28 '11 at 20:59

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.