Linux history命令添加时间,修改记录数量


添加时间

在/etc/profile 添加如下两行

HISTTIMEFORMAT="%Y-%m-%d %H:%M:%S "
export HISTTIMEFORMAT
[root@itpuxbbdb54 /]# 
[root@itpuxbbdb54 /]# source /etc/profile
[root@itpuxbbdb54 /]# 
[root@itpuxbbdb54 /]# 
[root@itpuxbbdb54 /]# history 
    1  2022-05-10 20:01:29 cd /etc/sysconfig/network-scripts/
    2  2022-05-10 20:01:29 ls

修改记录数

/etc/profile文件中找到配置项HISTSIZE,默认值为1000