How to delete history of last 10 commands in shell?

前端 未结 19 1828
孤城傲影
孤城傲影 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:35

    I used a combination of solutions shared in this thread to erase the trace in commands history. First, I verified where is saved commands history with:

    echo $HISTFILE
    

    I edited the history with:

    vi 
    

    After that, I flush current session history buffer with:

    history -r && exit
    

    Next time you enter to this session, the last command that you will see on command history is the last that you left on pathToFile.

提交回复
热议问题