Today I finally decide to make a script to keep my bash_history synchronized among all the machines I use. It’s a simple script that retrieves all the .bash_history files from all my machines, merges all the files into one, sort it, removes the duplicated lines and write it back to all the machines. The only drawback is that the original ordering of the history files is lost due to the alphabetical sorting step (needed to remove the duplicated lines).
WARNING: Make sure that your history file size limit is big enough to hold all the combined history files. Otherwise you’ll lose some of the entries. You can go to this post for reference on how to change the history file limits