Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Linux by (18.4k points)

Commands follow:

  511  clear

  512  history

  513  history -d 505

  514  history

  515  history -d 507 510 513

  516  history

  517  history -d 509

  518  history

  519  history -d 511

  520  history

Can I delete a single one by the history -d 511, but how do I delete the last 10 commands and in between 10 commands history by using a single command in my shell script?

Can we write the bash script and execute it for deletion of history?

1 Answer

0 votes
by (36.8k points)

Have you tried editing your history file directly:

~/.bash_history

Want to be a Linux expert? Come and join this Linux course.

Related questions

0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
asked Nov 30, 2020 in Linux by dev_sk2311 (45k points)

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...