Issue
When running a shell command without redirection, I sometimes in hindsight want to process the output I see on screen.
I often want to "grep" the output of a console in hindsight. I might not be able to run the command again with proper redirection: (The command might take a long time to run. The command might have produced side effects).
Is there some shell wizardry which I could use to: "Grep the last 100 lines of output in the terminal", without re-executing the command again with a redirect?
My current solution is to scroll up manually, and copy paste the last lines of output into a text file. I would prefer a fully scripted solution instead...
Solution
Is there some shell wizardry which I could use to: "Grep the last 100 lines of output in the terminal", without re-executing the command again with a redirect?
No.
My current solution is to scroll up manually, and copy paste the last lines of output into a text file. I would prefer a fully scripted solution instead...
Exactly, you have to use the program that is used to view the output, be it a graphical terminal in a graphical environment. Some such terminals allow to save the current "state" of terminal output to a file. Next time - use tmux
or screen
- i.e. a program that simulates the terminal.
Answered By - KamilCuk Answer Checked By - Katrina (WPSolving Volunteer)