1

Easily sync your shell history between computers

 6 months ago
source link: https://vitobotta.com/2023/10/14/easily-sync-your-shell-history-between-computers/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Easily sync your shell history between computers

For work, I often flip between my M2 Pro mini and an Intel MBP. To keep my data in sync, I use Nextcloud. It's a cool open-source tool, kind of like Dropbox or Google Drive, but with some extra bells and whistles.
I use the terminal a ton, so one thing that bugged me was syncing my zsh shell history. Just syncing the `~/.zsh_history` file didn't cut it. One computer's history would just overwrite the other's, causing a mess - i.e. loss of commands and/or sync conflicts. Also, I wanted to merge all the commands from both computers and remove duplicates, so I'd have the same shell history everywhere.
I tried a bunch of different solutions, both free and paid, but none of them hit the mark. They all had their own problems. Atuin looked promising, but it didn't always sync correctly. Plus, it needs a server to sync, and since I am already using Nextcloud for everything else, I wanted to use it for shell history too.
A lot of the solutions I found were way too complicated for such a simple problem. After a bit of tinkering, I came up with a simple way to sync my shell history that actually works!
Check it out on my GitHub repo.

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK