command line utility to merge bash_history

Latest on Hackage:

This package is not currently in any snapshots. If you're interested in using it, we recommend adding it to Stackage Nightly. Doing so will make builds more reliable, and allow to host generated Haddocks.

BSD3 licensed by Jiri Marsicek


Utility to be used with unison ( to merge .bash_history file accross multiple machines.


Clone the repository

git clone

Install using stack

cd merge-bash-history
stack install

Example configuration in unison preferences file

Assuming you have root set to your home directory and merge-bash-history is in your $PATH

Add following to your unsion .prf file

merge = Name .bash_history -> merge-bash-history CURRENT1 CURRENT2 > NEW
backupcurrent = Name .bash_history

Manual usage

merge-bash-history [INPUT-FILE1] [INPUT-FILE2] > [MERGED-FILE]


  • Does not support line deletion (e.g. manual removal of lines from .bash_history file)


  • Sorts .bash_history file by timestamp if not sorted
  • removes duplicates (comparing timestamp and command)

Recommended Bash settings

shopt -s histappend

From Pawel Hajdan (

comments powered byDisqus