随笔-开发环境-HISTORY设置

编辑~/.bashrc新增如下配置:

export HISTCONTROL=ignoreboth:erasedups
export HISTTIMEFORMAT="%Y-%m-%d %H:%M:%S "
export HISTSIZE=50000

export HISTCONTROL=ignoreboth:erasedups: 合并重复的命令,ignoredups 去除连续重复的命令,要消除整个命令历史中的重复命令,把 HISTCONTROL设置成 erasedups。参考:https://qastack.cn/unix/48713/how-can-i-remove-duplicates-in-my-bash-history-preserving-order

加入时间戳等信息:

export HISTTIMEFORMAT="%F %T `whoami` at `who am i | awk '{print $NF}'` "
posted @ 2024-12-28 10:52  LiYanbin  阅读(14)  评论(0)    收藏  举报