Skip to content

Instantly share code, notes, and snippets.

@GPrimola
Last active September 28, 2025 17:41
Show Gist options
  • Select an option

  • Save GPrimola/186bfa57a55688007b2d4dffc2980c9e to your computer and use it in GitHub Desktop.

Select an option

Save GPrimola/186bfa57a55688007b2d4dffc2980c9e to your computer and use it in GitHub Desktop.
zsh history tweaks
# HISTORY
HISTFILE=~/.zsh_history # location of the history file
HISTFILESIZE=1000000000 # history limit of the file on disk (lines)
HISTSIZE=1000000000 # current session's history limit
SAVEHIST=500000 # zsh saves this many lines from the in-memory history list to the history file upon shell exit
HISTTIMEFORMAT="[%F %T]"
setopt EXTENDED_HISTORY # records the time when each command was executed along with the command itself
setopt SHARE_HISTORY # allows multiple Zsh sessions to share the same command history
setopt INC_APPEND_HISTORY # history file is updated immediately after a command is entered
setopt APPENDHISTORY # ensures that each command entered in the current session is appended to the history file immediately after execution
# setopt HIST_IGNORE_SPACE # Do not record an event starting with a space.
# setopt HIST_EXPIRE_DUPS_FIRST # Expire a duplicate event first when trimming history.
# setopt HIST_FIND_NO_DUPS # Do not display a previously found event.
# setopt HIST_IGNORE_ALL_DUPS # Delete an old recorded event if a new event is a duplicate.
# setopt HIST_IGNORE_DUPS # Do not record an event that was just recorded again.
# setopt HIST_SAVE_NO_DUPS # Do not write a duplicate event to the history file.
# END HISTORY
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment