3

I open lxterminal, which shows up in ps output as x-terminal-emulator. I then enter a command which prints it's output to STDOUT, which is visible on my screen. The command finishes, and I am shown another prompt.

The output of the previous command is still visible, so I can copy and paste it by GUI text selection, but I would like to be able to access it from a script.

Options for accessing this output that I can imagine:

  1. Is it stored somewhere, like in /dev?
  2. Is it in memory somewhere that I could read with low-level tools?
  3. Can I script my terminal emulator to store the output of every command while still outputting it normally?
  4. Is there a tool to scrape text from GTK windows that could access the full terminal window contents?
  • 1
    Related: https://unix.stackexchange.com/q/109509/117549 and https://unix.stackexchange.com/q/370393/117549 – Jeff Schaller Sep 29 '18 at 23:16
  • similar, but neither would be a duplicate – Thomas Dickey Sep 29 '18 at 23:30
  • For your question #3: The script command can be used to produce a log file of everything displayed on a terminal. Note that the stored data includes any terminal control characters emitted by the program that produced the output, so it may not be as easy to scrape as you might think. – telcoM Sep 30 '18 at 05:22
  • Related: https://unix.stackexchange.com/q/483894 – sondra.kinsey Nov 30 '18 at 19:39