I want to delete history but not fully, suppose I have total 200 entries in my history and I want to delete from 101 to 150. Is this possible ?

I have seen multiple methods to delete history like history -d entry_number, .bash_history file, history -c command.


You can try this

for i in {1..50}
   history -d 101

This will delete history number 101 50 times or each time it deletes history number 101 next time 102 will become 101.

|improve this answer|||||

If you have vim you can do:

vim -c "101,150d | wq" your_file
|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.