Record SSH session for reporting

The issue is whenever logging ssh to a linux vm for investigating or doing something, after done, I want to report on what I did for writing into ticket. In the past, I use the historycommand and scroll back to the beginning. It's waste of time & effort, sometime cannot trace because of lacking scroll or closing terminal tab by human mistake, or wanna trace in the next few days.

So that I need a good solution for this to work effectively

touch /ssh.log
ssh <target> -v | tee -ia /ssh.log

For seeing output for tracking & reporting, use tail

tail -f -n +1 /ssh.log

Last updated