Terminal *output* history?
Solution 1:
You mention using byobu...
That's certainly one way of doing it. Byobu stores 10K lines of scrollback history per window or per split (pane).
You can enter scrollback easily by pressing Alt-PageUp, Alt-PageDown, or F7. Once you're in scrollback mode, you can search forward and backward using vi-like commands. Use /regex
to search forward, and ?regex
to search backward.
Solution 2:
You can use tee
to send your command output to a file and to the terminal at the same time.
Solution 3:
You can use script
to log your terminal session to a file. If you always want this to happen then add a suitable script
command to your .login
.
$ man script
Solution 4:
use screen -L
after exiting shell session (exit
command) you get a logfile in the same directory you started screen
then you can view the output with more
or less -R
Solution 5:
screen
can be set to log output.
One way to start it, within a running screen
session, is to press Ctrl-a, then :, then enter log
.
From man screen
:
log [on|off]
Start/stop writing output of the current window to a file "screenlog.n" in the
window's default directory, where n is the number of the current window.
This filename can be changed with the `logfile' command. If no parameter is
given, the state of logging is toggled. The session log is appended to the
previous contents of the file if it already exists. The current contents and
the contents of the scrollback history are not included in the session log.
Default is `off'.
logfile filename
logfile flush secs
Defines the name the log files will get. The default is "screenlog.%n". The
second form changes the number of seconds screen will wait before flushing the
logfile buffer to the file-system. The default value is 10 seconds.