Skip to content

zsh

share history across sessions / terminals

this used to be the default for oh my zsh users but they removed this feature without warning (granted, I don't know how you notify people about such a breaking change. nevermind...) but since this feature is just awesome, just add this to your local ~/.zshrc file to get it back:

setopt inc_append_history     # add commands to HISTFILE in order of execution
setopt share_history          # share command history data

restart your shell(s) and everything's awesome again.

ignore history with beginning space

say you want to prevent adding a command into the zsh history because it contains an API key, you can do this by putting a space in front of the command, like so (note the leading space):

 super_secret-api_key

to enable this with zsh, either add the following to your ~/.zshrc file or execute it manually beforehand:

setopt HIST_IGNORE_SPACE

temporarily disable history

open a new shell, disable the HISTFILE, do things, exit

$SHELL
unset HISTFILE
echo do your stuff now
exit

(oh-my-zsh) fix no match found

add this to your ~/.zshrc:

unsetopt nomatch

don't add backslashes

some more about that here