Node.js has included a persistent history with it’s REPL (real-eval-print loop)
for quite some time now. It’s a fantastic quality of life feature, and it even
supports reverse-i-search
.
The other day, I got to wondering, where the heck does this history even live?
Turns out, it’s just living in a text file in your home directory, similar to
how bash
and zsh
handles it.
The file in question is, ~/.node_repl_history
.
It contains a history, sans any sort of time of execution, of the commands
you’ve entered into the Node.js REPL. The most recent entries are at the top of
the file.
Since it’s just a simple text file, if you ever did want to clear the file out,
you could do so by running:
echo > ~/.node_repl_history