linux 清空history以及記錄原理

一、當前session執行的命令,放置緩存中,執行exit時,把緩存信息寫入~/.bash_historyhtml

二、當session直接被kill時,緩存中的歷史命令不會寫入~/.bash_historyshell

三、正確清空當前用戶的history的方法緩存

>~/.bash_history
history -c    #清空當前緩存中的命令
exit    #關閉shell鏈接,能夠避免寫入~/.bash_history
#執行exit,會把該命令記錄到~/.bash_history文件去

  

  

轉載於:https://www.cnblogs.com/dbcloud/p/6344427.htmlbash