ArchLabs Linux

How to Persist Terminal History?

Firstly, it seems ArchLabs uses ~/.zshrc, correct? Does it also use bash?

This post says to use shopt, but i’m getting “not available”.
shopt -s histappend

What’s the correct way on Arch?

Thx!

You can change your shell to bash if you want.

Change default shell

Have you tested that it doesn’t already work?

Fairly sure it’s set up to do this already.

i would not like to change the default shell to bash-- would like to get persistent history with zsh.

You mean persistent history, without putting a shopt command in the rc file? Def not working for me.

shopt is not used in zsh, option command here is setopt

Have you removed the default shell configs? If not then it is indeed enabled already, check ~/.zsh/settings/options.zsh

You should find something like

# history
setopt share_history append_history extended_history

If not then add it to your ~/.zshrc and you’ll have shared history. I also suggest reading man zshoptions

2 Likes

are there supposed to be multiple entries?

setopt hist_verify share_history append_history extended_history
setopt hist_ignore_dups hist_save_no_dups hist_ignore_space
setopt inc_append_history hist_ignore_all_dups hist_expire_dups_first

Cuz i found those 3 lines in the config file.
i replaced them with your line.
still not getting persistent terminal history.

By “persistent”, i mean it remembers history between logins.
Any ideas?

thx

Fixed.

Seems archlabs default .zshrc is missing SAVEHIST and HISTFILE (although it has export HISTSIZE… and export SAVEHIST…

HISTSIZE / SAVEHIST are zsh-internal parameters, exporting them makes no sense

bug report: