If you’re troubleshooting an issue on your server and you suck at taking documention, you can simply pipe the SSH output into a file for review later:
What is really cool about this method (As opposed to just saving the history) is that it will also save the result of the command.
You can also automate this. Create a file in your ~/bin/ directory called sshlog or similar and input the following code:
Set the execution bits and you can now run sshlog [email protected] and any other flags you would normally run with SSH and it will be appended to your file (as defined by the -a flag in tee). If you want this to always run when you kick of ssh, simply create an alias: