Chinaunix首页 | 论坛 | 博客
  • 博客访问: 917201
  • 博文数量: 194
  • 博客积分: 7991
  • 博客等级: 少将
  • 技术积分: 2067
  • 用 户 组: 普通用户
  • 注册时间: 2007-12-09 22:03
文章分类

全部博文(194)

文章存档

2010年(8)

2009年(71)

2008年(109)

2007年(6)

我的朋友

分类: LINUX

2009-05-09 08:26:25

Adding Date And Time To Your Bash History

This is a quick but handy addon (RedHat/CentOS) to enhance your bash history (bash > 3.0).It comes in handy particularly if there are multiple people maintaining a given server (so you can see when a command was performed) or even if you are the sole maintainer, but can't remember exactly when you did or changed something.
 
Edit your /etc/bashrc and append to the bottom:
export HISTTIMEFORMAT="%h/%d - %H:%M:%S"
 
From next login instead of:
574  tail -f /var/log/maillog
575  mailq | tail -15
576  tail -f /var/log/maillog
577  less /var/log/maillog
 
you get:
1002  Apr/30 - 11:46:16 grep duncan /var/log/maillog
1003  Apr/30 - 14:17:40 passwd jduncan
1004  Apr/30 - 14:18:02 smbpasswd jduncan
1005  Apr/30 - 14:50:28 history 10
 
Hope this helps someone;)
阅读(865) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~