#添加环境参数
[root@server ~]# cat /etc/profile.d/history.sh
#!/bin/bash
export HISTFILESIZE=3000
export HISTSIZE=3000
export HISTTIMEFORMAT="%Y/%m/%d %H:%M:%S: "
#生效
[root@server ~]# source /etc/profile
#验证结果
[root@server ~]# history
1 2021/06/03 10:08:07: ps -ef
2 2021/06/03 10:08:07: ps -ef
3 2021/06/03 10:08:07: id
4 2021/06/03 10:08:07: cat /etc/sudoers
5 2021/06/03 10:08:07: ps -ef
6 2021/06/03 10:08:07: cat /etc/hosts
7 2021/06/03 10:08:07: sudo -i
8 2021/06/03 10:08:07: su - root
9 2021/06/03 10:08:07: sudo -i
10 2021/06/03 10:08:07: exit
11 2021/06/03 10:08:07: cat /etc/hosts
12 2021/06/03 10:08:07: cat /etc/sudoers
版权声明:本文内容来自第三方投稿或授权转载,原文地址:https://blog.51cto.com/slapping/2849008,作者:类似简单,版权归原作者所有。本网站转在其作品的目的在于传递更多信息,不拥有版权,亦不承担相应法律责任。如因作品内容、版权等问题需要同本网站联系,请发邮件至ctyunbbs@chinatelecom.cn沟通。