How may I read the EXISTING output content from another terminal, like an SSH terminal?

The scenario is I ran a program in a GUI session but later on I need to read its output remotely without touching its GUI session (I know I can if I use VNC). I did a bit search in StackExchange but their stories are different.

https://unix.stackexchange.com/a/72334 gives a solution to redirecting its FUTURE output towards the remote terminal but still, the EXISTING output is missing. Any solution to this?

2 Answers 2


Content that was written in the past exists only in that terminal (usually in memory of that process). If you want to read it you either need to discuss the documentation of your terminal, if it is accessible in some way (xterm or screen have a way to query content of the screen and/or scroll buffer), what you need to make it accessible or you will have to dig it directly from the memory of your terminal process.

As far as I know, there is no general way of doing that.

  • The general way is to always have screen running in your shell.
    – Philippos
    May 26, 2017 at 11:41
  • As you can see from the question, it is not. Can you clarify the reason for your downvote?
    – Jakuje
    May 26, 2017 at 11:43
  • Because this is highly misleading, as I see it. screen is the solution for scenarios like this. It's highly unlikely that this happened only a single time to the OP and now he is sitting in front of his machine waiting for a solution to go on. He rather is looking for a way to handle this situation as it may happen any time, like so many others who were glad to be pointed to screen instead of being told "no way". If the OP tells us I'm wrong, I'll apologize, but I also think of future readers.
    – Philippos
    May 26, 2017 at 11:56
  • Thank you all for these comments. Fortunately, I have full access to the physical machine to watch its GUI output (There is another user who should operate on his own GUI session, so I can't VNC to it). But still, this question attracts me because it would be useful for those facing the same scenario. The "screen habit" sounds really good at this stage. Then here I have a new question: Is this a design negligence in *nix, as this scenario shouldn't have been seen rarely?
    – cyfex
    May 26, 2017 at 19:14
  • Some terminal emulators like screen or xterm (print command), or linux virtual consoles (/dev/vcs*) allow querying the content of the screen and/or scroll buffer. May 31, 2017 at 9:26

Use screen in your terminal session. You can later attach to that session with the -r option to see the current view of that terminal as you left it and continue in that same shell.

See man screen for more.

  • This will not help afterwards.
    – guntbert
    May 26, 2017 at 11:28
  • @guntbert Not if you forgot to use screen in your shell, of course. But this is such an essential tool that I recommend to start it generally in every shell. That's what I and many others do by default and I highly recommend it to the OP if he faces the given scenario more than one time in his life.
    – Philippos
    May 26, 2017 at 11:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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