Skip to main content
Question Protected by ggorlen
Added tag
Link
Justin John
  • 9.5k
  • 14
  • 71
  • 130
Post Reopened by Justin John, CloudyMarble, HaveNoDisplayName, SuperBiasedMan, Boann
edited title
Link
Justin John
  • 9.5k
  • 14
  • 71
  • 130

How to delete history of last 10 commands in linuxshell?

added 75 characters in body
Source Link
Justin John
  • 9.5k
  • 14
  • 71
  • 130

Commands follows

  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

I can delete single one by history -d 511, but how to delete last 10 commands and in between 10 commands history using single command in shell?

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

Commands follows

  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

I can delete single one by history -d 511, but how to delete last 10 commands and in between 10 commands using single command in shell?

Commands follows

  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

I can delete single one by history -d 511, but how to delete last 10 commands and in between 10 commands history using single command in shell?

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

Post Closed as "off topic" by lc., Barmar, SWeko, Dan Moulding, Toto
edited tags
Source Link
Justin John
  • 9.5k
  • 14
  • 71
  • 130
Loading
Source Link
Justin John
  • 9.5k
  • 14
  • 71
  • 130
Loading