Linux更改配置文件实现执行history的时候显示时间和用户
Linux更改配置文件实现执行history的时候显示时间和用户
安装vim工具
修改配置文件~/.bash_profile
添加内容export HISTTIMEFORMAT="%F %T"然后保存
重新登录系统
[chen@centos7 ~]$ su -
Password:
Last login: Thu Jan 28 23:26:17 -10 2021 on pts/0
[root@centos7 ~]# yum install vim
[chen@centos7 ~]$ vim .bash_profile
#.bash_profile
#Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
#User specific environment and startup programs
PATH=$PATH:$HOME/.local/bin:$HOME/bin
export PATH
export HISTTIMEFORMAT="%F %T"
[chen@centos7 ~]$ history
1 2021-01-28 23:20:28yum install vim
2 2021-01-28 23:20:49vim .bash_profile
3 2021-01-28 23:21:01history

浙公网安备 33010602011771号