How to recover bash output of an already closed window?

6

2

I have run a specific program in a bash terminal and I closed it by mistake before reading its output. Is it possible to recover the information that was sent to the stdout by taking a look at some sort of bash stdout history log?

Thank you so much.

Oriol Nieto

Posted 2013-05-21T14:32:28.793

Reputation: 163

Depending on the configuration of the program you are using, there may be a log with the output. – fedorqui – 2013-05-21T14:33:23.217

It's a program that I wrote myself, so I know that I'm not logging anything. (Unless Python generates an automatic log... does that exist at all?) – None – 2013-05-21T14:35:34.493

Well I refer to the terminal you are using. For example, PuTTY normally saves logs. – fedorqui – 2013-05-21T14:39:04.823

This would be a feature of the terminal-emulator (e.g. xterm, gnome-terminal, etc.) because the shell quite literally has no idea what the program sent to stdout. I've not known a common terminal program that logs by default, so you're probably out of luck. – msw – 2013-05-21T14:39:58.117

Thank you so much for your answers. I am using Terminal.app of OSX. Unfortunately, I haven't found any feature like that... – None – 2013-05-21T14:43:12.070

Answers

6

No, there isn't STDOUT history on the filesystem.

If you don't have logging enabled for your terminal then you are out of luck.

Chris

Posted 2013-05-21T14:32:28.793

Reputation: 1 766

0

If you work with a script log then it records everything in that .....

Next time run this at your home directory: script -a yoursession.log That would record all the commands and what ever output you get while you work into the log file.

Man page script command description:

Script makes a typescript of everything printed on your terminal. It is useful for students who need a hardcopy record of an interactive session as proof of an assignment, as the typescript file can be printed out later with lpr(1).

nitin

Posted 2013-05-21T14:32:28.793

Reputation: 179