Skip to content

Instantly share code, notes, and snippets.

@nightcrawler-
Created March 3, 2023 02:26
Show Gist options
  • Save nightcrawler-/c2d4cf4ed1488bcff4136a5a11ce5e30 to your computer and use it in GitHub Desktop.
Save nightcrawler-/c2d4cf4ed1488bcff4136a5a11ce5e30 to your computer and use it in GitHub Desktop.
deduplicate .zsh_history
awk '!a[$0]++' ~/.zsh_history > ~/.zsh_history_new && mv ~/.zsh_history_new ~/.zsh_history
# This command reads the current Zsh history file (~/.zsh_history),
# removes duplicates using awk, saves the unique commands to a new file (~/.zsh_history_new),
# and finally replaces the old history file with the new one.
# After running this command, you should have a Zsh history file without any duplicates.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment