Skip to content

Instantly share code, notes, and snippets.

@d-amend
Created January 17, 2022 17:42
Show Gist options
  • Save d-amend/4a30ee5a2d4c2df6f1e9d0b73011ff44 to your computer and use it in GitHub Desktop.
Save d-amend/4a30ee5a2d4c2df6f1e9d0b73011ff44 to your computer and use it in GitHub Desktop.
*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: https://stackoverflow.com/a/13661794
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment