Synchronising Zsh history over the Internet with Oh My Zsh and history-sync
Occasionally I’ve thought to myself:
“What was that complex command sequence I ran on my laptop when I was using it 2 hours ago?”
I’ve either had to wait until I’m in range of my laptop to check my shell history, or I have to remember to email myself the commands… None of these solutions are really helpful when I’m in a jam.
That’s why I thought to myself:
“Why doesn’t Oh-My-Zsh have such a plug-in, where I can synchronize my ZSH history over the Internet?”
In the projects 200+ plug-in base, not one plug-in achieves said functionality. And that’s why I quickly wrote history-sync.
The basic concept is:
- Encrypt $HOME/.zsh_history using GPG public key encryption on source computer
- Push encrypted zsh_history to a remote Git repository
- Pull encrypted zsh_history from said Git repository and decrypt on destination computer
- Merge decrypted zsh_history with $HOME/.zsh_history
All of this is achievable using history-sync’s alias commands:
zhps -r <string> -r <string> -r ...
Here’s an example of it’s use.Tweet