Over the last few months, I've been trying out the fish shell as my interactive shell. One issue that somewhat irritates me is that the shell occasionally forgets recent commands from its command line history.

Let's say I have a personal script in my $PATH called mail-get.sh. I can run it by typing its name on the command line and then recall the command at a later time by just typing get and pressing Up-arrow.

Sometimes (a few times a day), the recall fails, and instead, I get older commands that happen to contain the string get. The older command may be several months older than the most recent invocation of my mail-get.sh script. Using history merge at that point always resolves the issue.

Unfortunately, I can't reproduce the issue on purpose.

I have not changed how fish should manage its history. My home directory is not network-mounted. I run several shell sessions in different tmux panes at the same time.

I'm most heavily using fish version 3.5.1 on FreeBSD.

My question is whether this is something that other users of the shell experience too, and whether it has a known cause and a convenient solution, or whether I should report it as a bug to the fish shell project.

  • fish suffering from short-term memory issues: Have my upvote for a pun'ed title; we need more of these. Commented Sep 8, 2022 at 9:27
  • 1
    This is quite unusual. One thing which might cause this is if your timezone were to change, or the clock otherwise changes - fish uses the time(3) function to decide which items are too new to show, if time were to go backwards then some items would not be shown. Another possibility is the file is corrupt in some way. The history file is typically in ~/.local/share/fish/fish_history, you can poke around in there to see if anything looks wrong. Commented Sep 8, 2022 at 17:55
  • @ridiculous_fish I'm running the ordinary ntpd service on the machine, and as far as I can see, it's keeping the time offset to the pool servers within two milliseconds. I never manually step the time. The history file is in no way corrupt, that I can see. It feels like the shell initially reads the history from the history file and then remembers all old entries but only keeps N new entries.
    – Kusalananda
    Commented Sep 8, 2022 at 21:13
  • 1
    I experience this as well, once or twice a day. Commented Aug 9, 2023 at 14:47
  • 1
    Yeah, me too. I've been using fish for years (on macOS, installed and updated with brew) and this happens to me pretty frequently, probably at least once a week. Right now none of my open shells can find a command I use almost daily. New shells can find it, and history merge fixes the situation in old ones. Commented Jan 18 at 6:29


You must log in to answer this question.

Browse other questions tagged .