首页 技术 正文
技术 2022年11月9日
0 收藏 319 点赞 2,916 浏览 889 个字

1.在/etc/profile的最后加入例如以下部分:
USER_IP=`who -u am i 2>/dev/null| awk ‘{print $NF}’|sed -e ‘s/[()]//g’`  export HISTTIMEFORMAT="[%F %T][`whoami`][${USER_IP}] " 
2. source /etc/profile
3.随便运行一下什么命令,
4.运行history,看效果:  311  [2013-08-28 14:39:20][root][192.168.80.1] history  312  [2013-08-28 14:39:43][root][192.168.80.1] df -h  313  [2013-08-28 14:39:45][root][192.168.80.1] df -g  314  [2013-08-28 14:39:47][root][192.168.80.1] history  315  [2013-08-28 14:40:01][root][192.168.80.1] ifconfig  316  [2013-08-28 14:44:53][root][192.168.80.1] init 6  317  [2013-08-28 14:46:56][root][192.168.80.1] sdfsdfsd  318  [2013-08-28 14:46:58][root][192.168.80.1] ls  319  [2013-08-28 14:47:02][root][192.168.80.1] hostory  320  [2013-08-28 14:47:04][root][192.168.80.1] history  321  [2013-08-28 14:48:35][root][192.168.80.1] cat /etc/profile  322  [2013-08-28 14:54:32][root][192.168.80.1] history
注意:1和2必须先运行完之后。才干看到history的效果。

若是想看1个月前的history,而那时还没有运行1和2,这样的情况下是看不到想要的效果的。

相关推荐
python开发_常用的python模块及安装方法
adodb:我们领导推荐的数据库连接组件bsddb3:BerkeleyDB的连接组件Cheetah-1.0:我比较喜欢这个版本的cheeta…
日期:2022-11-24 点赞:878 阅读:9,488
Educational Codeforces Round 11 C. Hard Process 二分
C. Hard Process题目连接:http://www.codeforces.com/contest/660/problem/CDes…
日期:2022-11-24 点赞:807 阅读:5,903
下载Ubuntn 17.04 内核源代码
zengkefu@server1:/usr/src$ uname -aLinux server1 4.10.0-19-generic #21…
日期:2022-11-24 点赞:569 阅读:6,736
可用Active Desktop Calendar V7.86 注册码序列号
可用Active Desktop Calendar V7.86 注册码序列号Name: www.greendown.cn Code: &nb…
日期:2022-11-24 点赞:733 阅读:6,487
Android调用系统相机、自定义相机、处理大图片
Android调用系统相机和自定义相机实例本博文主要是介绍了android上使用相机进行拍照并显示的两种方式,并且由于涉及到要把拍到的照片显…
日期:2022-11-24 点赞:512 阅读:8,127
Struts的使用
一、Struts2的获取  Struts的官方网站为:http://struts.apache.org/  下载完Struts2的jar包,…
日期:2022-11-24 点赞:671 阅读:5,289