Skip to content

Instantly share code, notes, and snippets.

@i3zhe
Created August 9, 2013 06:41
Show Gist options
  • Save i3zhe/6191614 to your computer and use it in GitHub Desktop.
Save i3zhe/6191614 to your computer and use it in GitHub Desktop.
When accidentally pasting a file into the shell it puts a ton of ugly nonsense entries in the bash history. Is there a clean way to remove those entries?
rmhist() {
start=$1
end=$2
count=$(( end - start ))
while [ $count -ge 0 ] ; do
history -d $start
((count--))
done
}
rmhist 800 1000 # will remove history from line 800 to 1000
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment