I ran a command in `screen` which output fills more than current screen, how to retrieve this output without scrolling?
Jun 12, 9:02am

To retrieve the full output of a command run in screen without scrolling, you have a few options:

1. Use screen's scrollback buffer

  • Enter copy mode in screen by pressing: Ctrl + A, then [ (left square bracket).
  • Now you can navigate using:
    • Arrow keys or Page Up/Page Down to scroll.
    • / to search forward, ? to search backward.
  • To copy text:
    • Press Space to mark the start.
    • Move the cursor to the end.
    • Press Enter to copy the selected text to the clipboard.
  • Exit copy mode by pressing Esc or Ctrl + C.

2. Redirect output to a file

If you want to avoid scrolling entirely, redirect the command's output to a file when running it:

bash
your_command > output.txt 2>&1
  • This saves both stdout and stderr to output.txt.
  • Open the file later with less, cat, or any text editor.

3. Use tee to save and view output

If you want to see the output in real-time and save it:

bash
your_command | tee output.txt
  • This displays the output on the screen and saves it to output.txt.

4. Increase screen's scrollback buffer

If you want to keep more output in memory for scrolling:

  • Add this to your ~/.screenrc:
    text
    defscrollback 10000
  • Or start screen with:
    bash
    screen -h 10000
  • This sets the scrollback buffer to 10,000 lines.

Which method do you prefer, or do you need help with a specific step?

Jun 12, 9:02am

This is a shared conversation and may include unverified content that doesn't reflect Mistral AI's views. Login to resume chatting.

Vibe can make mistakes. Check answers. Learn more