Send history of current host to some other host over ssh
Sometimes I want to save the history of current host on another host. This is to ensure that I can use copy/paste on other host to run the commands. To this, I found a simple solution –
history| ssh <user>@<host> 'cat - > /tmp/history'
And on the new host, you can find the history in file “/tmp/history”, cool :). Now I can quick edit this file to create this as shell script as well if required. How cool is that.
Related Articles:
- 2015/09/21 Executing commands on multiple hosts
- 2017/12/25 send mail using telnet from script
- 2017/01/09 ansible with docker dynamic inventory
- 2016/04/04 ssh – remove offending key.
- 2015/03/04 ssh authorized keys – limit ssh session to custom command
Authored By Amit Agarwal
Amit Agarwal, Linux and Photography are my hobbies.Creative Commons Attribution 4.0 International License.