1.history添加日期
1.编辑文件
vim /etc/bashrc
2.末尾添加:
HISTTIMEFORMAT="%F %T "
export HISTTIMEFORMAT
3.刷新
source /etc/bashrc
4.运行history 查看
history
2.汇总命令,并且不同的终端可以通过上翻查询到命令
1.编辑文件
vim /etc/bashrc
2.末尾添加
# Avoid duplicates
export HISTCONTROL=ignoredups:erasedups
# When the shell exits, append to the history file instead of overwriting it
shopt -s histappend
# After each command, append to the history file and reread it
export PROMPT_COMMAND="${PROMPT_COMMAND:+$PROMPT_COMMAND$'\n'}history -a; history -c; history -r"
3.刷新一下
source /etc/bashrc
4.运行history 查看
history
3.调整大小,增加到10000条
1.编辑文件
vim /etc/bashrc
2.末尾添加
export HISTSIZE=10000
3.刷新一下
source /etc/bashrc
4.运行history 查看
history
4.完整的配置文件
vim /etc/bashrc
末尾添加 如下
HISTTIMEFORMAT="%F %T "
export HISTTIMEFORMAT
# Avoid duplicates
export HISTCONTROL=ignoredups:erasedups
# When the shell exits, append to the history file instead of overwriting it
shopt -s histappend
# After each command, append to the history file and reread it
export PROMPT_COMMAND="${PROMPT_COMMAND:+$PROMPT_COMMAND$'\n'}history -a; history -c; history -r"
export HISTSIZE=10000