ITerm: Is there a way to reprint output of previous command without running it?

842 views Asked by At

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)

1

There are 1 answers

2
Ron On

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 called typescript in your HOME folder.

Once you are done, you can exit, and then have all of the input + output in that typescript log file.