How to delete history of last 10 commands in shell?

前端 未结 19 1854
孤城傲影
孤城傲影 2021-01-29 18:47

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  hist         


        
19条回答
  •  时光取名叫无心
    2021-01-29 19:42

    Maybe will be useful for someone.
    When you login to any user of any console/terminal history of your current session exists only in some "buffer" which flushes to ~/.bash_history on your logout.
    So, to keep things secret you can just:
    history -r && exit
    and you will be logged out with all your session's (and only) history cleared ;)

提交回复
热议问题