Whenever I open a new instance of a terminal, the history is empty. Why is that? Do I need to set something up? In bash there's no need for this, though.
History isn’t preserved in zsh
command historyzsh
command historyzsh
Whenever I open a new instance of a terminal, the history is empty. Why is that? Do I need to set something up? In bash there's no need for this, though.
Best Answer
Bash and zsh have different defaults. Zsh doesn't save the history to a file by default.
When you run zsh without a configuration file, it displays a configuration interface. In this configuration interface, select
then review the proposed settings and select
Repeat for the other submenus for (2) completion, (3) keybindings and (4) options, then select
from the main menu.
The recommended history-related settings are
I would use a different name for the history file, to indicate it's zsh's history file. And 1000 lines can be increased on a modern system.
These lines go into
~/.zshrc
, by the way.