在Linux环境中可以通过方向键的上下按键查看近期键入的命令.但这种方法只能一个一个的查看,其实系统提供了查看所有历史命令的方法. 在终端中输入以下命令查看所有命令: history [root@template ~]# history ifconfig vim /etc/ssh/sshd_config /etc/init.d/sshd restart vim /boot/grub/grub.conf vim /etc/selinux/config vim /etc/sysconfig/netw
需求描述: 在linux环境中,有的时候为了审计的需要,要记录谁什么时间从什么IP登录,执行了什么命令,bash的history命令就能够记录这些信息,但是在默认的情况下,是不记录时间的,所以呢,在这里记录下,对其进行改造. 操作过程: 1.默认的history命令,只是显示行号,执行的命令 [root@testvm01 ~]# history | more 3 ./test.sh 4 ls 5 vi nmon16e_x86_rhel65 6 cdd /opt