HackerReposA FIELD GUIDE TO OPEN SOURCE
ProSponsor the shelf♧ 0
← Back to top all-time
larkery
zsh-histdb
Shell2017–2026
larkery / zsh-histdb

zsh-histdb

A slightly better history for zsh

17Distinct people
22Mentions
0Explicit recommenders
1.4KGitHub stars
REPOSITORY AT A GLANCE

What to know before exploring

What it is

A slightly better history for zsh

GitHub

Where it is used

No documented product use was verified in the last source check.

What people are saying

No recommendation phrase was found in the indexed comments.

No classified warning is attached to this page. Read the discussions before treating silence as approval.

Also in these discussions

Mentioned in the same Hacker News threads. That is not proof they are substitutes.

This week on Hacker News

Nov 7–Nov 14 UTC · Direct repository links and separately labeled related project stories. Indexed through 11/14/2026, 5:04:57 PM UTC.

No direct repository links were found in the indexed HN discussions over the past seven days. Older discussions are available below.

Mentions over time

HN mentions by year22 dated mentions

Observed mentions: 2017-04-13 16:00:37 UTC to 2026-07-24 15:41:22 UTC.

0123452017-01-01 00:00:00 UTC to 2018-01-01 00:00:00 UTC (exclusive): 3 mentions; 1 submissions, 2 comments20172018-01-01 00:00:00 UTC to 2019-01-01 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2019-01-01 00:00:00 UTC to 2020-01-01 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2020-01-01 00:00:00 UTC to 2021-01-01 00:00:00 UTC (exclusive): 4 mentions; 0 submissions, 4 comments2021-01-01 00:00:00 UTC to 2022-01-01 00:00:00 UTC (exclusive): 4 mentions; 1 submissions, 3 comments20212022-01-01 00:00:00 UTC to 2023-01-01 00:00:00 UTC (exclusive): 3 mentions; 0 submissions, 3 comments2023-01-01 00:00:00 UTC to 2024-01-01 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 comments2024-01-01 00:00:00 UTC to 2025-01-01 00:00:00 UTC (exclusive): 5 mentions; 0 submissions, 5 comments2025-01-01 00:00:00 UTC to 2026-01-01 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 comments2026-01-01 00:00:00 UTC to 2027-01-01 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 comments. Incomplete calendar period.2026*

* An incomplete calendar period is marked with an outlined bar. Its count is not directly comparable with a full period.

Counts come from the repository’s dated source evidence. Index cutoff: 2026-11-02 08:16:59 UTC.

View mention counts and date ranges
UTC ranges include their start and exclude their end. Select a period to filter the source evidence.
PeriodStart (UTC)End (exclusive, UTC)MentionsSubmissionsComments
20172017-01-01 00:00:00 UTC2018-01-01 00:00:00 UTC312
20182018-01-01 00:00:00 UTC2019-01-01 00:00:00 UTC000
20192019-01-01 00:00:00 UTC2020-01-01 00:00:00 UTC000
20202020-01-01 00:00:00 UTC2021-01-01 00:00:00 UTC404
20212021-01-01 00:00:00 UTC2022-01-01 00:00:00 UTC413
20222022-01-01 00:00:00 UTC2023-01-01 00:00:00 UTC303
20232023-01-01 00:00:00 UTC2024-01-01 00:00:00 UTC101
20242024-01-01 00:00:00 UTC2025-01-01 00:00:00 UTC505
20252025-01-01 00:00:00 UTC2026-01-01 00:00:00 UTC101
2026 (partial)2026-01-01 00:00:00 UTC2027-01-01 00:00:00 UTC101

What Hacker News says

22 sources
I strongly recommend storing your shell history in a database, but if you're more of a minimalist, you might want to look at zsh-histdb[0]. It only support zsh, and doesn't have cloud syncing, but its also written entirely in shell script, doesn't have "accounts" or rely on sponsors, and it is far simpler. I have been using it for years and it has been absolute bliss. Whenever I run a command, it is immediately available in the history for all of my shells, and I no longer have commands disappear from my history unexpectedly. [0] https://github.com/larkery/zsh-histdb
In Modern Unix Tool List
I use zsh-histdb which stores the history in SQLite with context. Then I have few different queries/ways to interact with it. For example I have a line completion (which also shows as grayed out text while I type) based on most frequently used commands with give prefix with additional weighting depending how close in the directory tree they were used. [0]: https://github.com/larkery/zsh-histdb
In Keeping a long shell history
I often have multiple concurrent sessions of terminal open, which leads to messed up history interactions. One solution I've encountered (but have not tested yet) is zsh-histdb [0]. It stores sessions' history to a SQLite db instead of a single appended file, with extra metadata about when commands were run, what session, etc. If you've already got your .zshrc file open to mess with the history settings it might be worth checking out that tool while you're at it. 0: https://github.com/larkery/zsh-histdb
In Fixing macOS Zsh Terminal History Settings
I use zsh-histdb[1], which records my entire shell history for all time in a database, which also stores: • The start and stop times of the command • The working directory where the command was run • The hostname of the machine • A unique per-host session ID, so history from several sessions is not confused • The exit status of the command This the working directory of the command has been especially useful for me to get the context of what I did, not only the command itself. [1] - https://github.com/larkery/zsh-histdb
In Ask HN: Can I see your cheatsheet?
Alternatives (without judgement): https://github.com/cantino/mcfly https://github.com/jcsalterego/historian https://github.com/larkery/zsh-histdb + https://github.com/m42e/zsh-histdb-fzf https://github.com/ellie/atuin All of these except the OP (I think) use SQLite databases. Personally I use zsh-histdb, which is great but only for ZSH. I'm working on adding a rich SQLite history to nushell so I can finally try nu: https://github.com/nushell/reedline/pull/401 .
In RESH: Rich Enhanced Shell History
Here is a zsh function (added to ~/.zshrc) I made for use with https://github.com/larkery/zsh-histdb to get the same effect, but only showing commands whose exit_status is 0: jog() { sqlite3 $HOME/.histdb/zsh-history.db " SELECT replace(commands.argv, ' ', ' ') FROM commands JOIN history ON history.command_id = commands.id JOIN places ON history.place_id = places.id WHERE history.exit_status = 0 AND dir = '${PWD}' AND places.host = '${HOST}' AND commands.argv != 'jog' AND commands.argv NOT LIKE 'z %' AND commands.argv NOT LIKE 'cd %' AND commands.argv != '..' ORDER BY start_time DESC LIMIT 10 " }
In Jog: Print the last 10 commands you ran in the current directory
I always respect when people take the time to put a small but useful thing like this up in a repo by itself. It has always been a frustration that the current working directory metadata isn't saved along with history entries, so you can never really reconstruct what was run. Edit: I should really try out https://github.com/larkery/zsh-histdb. There's no reason a modern system's history shouldn't store start and finish timestamps, return code, current working directory, etc.
In Jog: Print the last 10 commands you ran in the current directory

Showing the 15 most recent of 22 sources. Enable JavaScript to search and browse every indexed mention.

MAKE YOURSELF AT HOME

A few shortcuts

/
Search the collection
?
Open this guide
Esc
Close dialogs and navigation

Your saved repositories and interests stay in this browser.