shell cleanup history

bash

~/.bash_logout

# Flush the in-memory history, then persist the emptiness to disk.
history -c && history -w;

fish

查看 fish shell 版本

echo $version

终端运行 builtin history clear 即可清空 shell 命令的历史记录。

退出 当前运行的 shell 进程之前触发此函数

~/.config/fish/config.fish

function bye --on-process-exit %self
    builtin history clear
    echo byeeeeeeee
end
  • https://xbuba.com/questions/47890353
  • https://stackoverflow.com/questions/47890353/clear-fish-shell-history-permanently-across-sessions
  • https://www.cnblogs.com/softwaretesting/archive/2012/02/14/2350688.html