Of course, we can feed the output of any command to a file. Using command > /tmp/filename
Or even better use command | tee /tmp/filename
to have the standard output be fed onto the terminal as well as the file name.
However, If I just executed command
is there a way for ITerm to reprint the output that command
already fed to console without re-running the command (example use case: command is not idempotent and I want to grep
something without having to touch the mouse)
You could use the
script
command, which records your input + the output your commands generate.To use it, just run
script
at the beginning, before you start any execution, and this will throw you in a new shell. which gets recorded in a file calledtypescript
in your HOME folder.Once you are done, you can
exit
, and then have all of the input + output in thattypescript
log file.