sharing or synchronizing history between Zsh and Bash

If you are using the defaults for bash and zsh:

$ cat ~/.histfile >> ~/.bash_history
$ youreditor ~/.zshrc
# Here change your config to:
HISTFILE=~/.bash_history
$ rm ~/.histfile

Now you have the same file for history in both shells.


Not exactly what you were looking for, but in order to import from bash to zsh, you can use this node.js script:

// This is how I used it:
// $ node bash-history-to-zsh-history.js >> ~/.zsh_history

var fs = require("fs");
var a = fs.readFileSync(".bash_history");
var time = Date.now();
a.toString().split("\n").forEach(function(line){
  console.log(": "+ (time++) + ":0;"+line);
});

Source