Skip to content

Instantly share code, notes, and snippets.

@radist2s
Created April 1, 2022 18:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save radist2s/1a6dd3e3b8d59065c4849bf268e605fb to your computer and use it in GitHub Desktop.
Save radist2s/1a6dd3e3b8d59065c4849bf268e605fb to your computer and use it in GitHub Desktop.
Remove zsh history entry

Remove zsh history entry

*BSD/Darwin (macOS):

LC_ALL=C sed -i '' '/porn/d' $HISTFILE

Linux (GNU sed):

LC_ALL=C sed -i '/porn/d' $HISTFILE

This will remove all lines matching "porn" from your $HISTFILE.

With setopt HIST_IGNORE_SPACE, you can prepend the above command with a space character to prevent it from being written to $HISTFILE.

Source

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment