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
scriptcommand, which records your input + the output your commands generate.To use it, just run
scriptat the beginning, before you start any execution, and this will throw you in a new shell. which gets recorded in a file calledtypescriptin your HOME folder.Once you are done, you can
exit, and then have all of the input + output in thattypescriptlog file.