Sometimes while working on the terminal or commandline as you know it, the history becomes clogged with simple common commands like ls -al
and you want to remove X number of lines to keep your history compact and relevant. Here’s a simple command that works:
for i in {1..total_count}; do history -d start_from; done
This deletes a total total_count
start_from
Usage:
for i in {1..40}; do history -d 1000; done
Enjoy.