Article may be outdated

This article is 46 days old. Some details may have changed since publication.

Hacker News·5 min read·hard

Tracking down a Zsh history data loss bug

I
ingve
✦AI Summary

A developer details the process of debugging a persistent data loss issue within the Zsh shell history file. The investigation involved patching the shell to force a crash and analyzing core dumps to identify the root cause.

Why it matters

Understanding and fixing low-level shell bugs improves the reliability of development environments for engineers who rely on command-line history.

✦Dive DeeperCreate a free account to unlock

For many years, I sometimes discovered that commands I was sure I had run were no longer present in my Z shell history file ( ~/.zsh_history ). In this article, I will show you how I tracked down the bug. Spoiler: ultimately, patching Zsh to make it crash loudly and analyzing the crash’s core dump was the winning strategy!

Zsh 5.9.2 (released July 12th, 2026) contains a fix for this issue — open it after reading this investigation to not spoil the fun.

Occasionally, I noticed that commands I knew I executed the day before were not findable in my shell history, meaning pressing Ctrl+R for backward history search yielded no results. Whenever I noticed this, my shell history file contained only very old entries, with years of newer entries missing.

Continue reading on Headlinne

Create a free account to read the full article.

Read full article →
technology
✦

Get smarter about the news

Sign up free for a feed built around what you actually care about, Dive Deeper research on any story, and the full text of every article.

Create free account

Already have an account? Sign in