history命令显示出详细时间
文章摘自:
http://blog.csdn.net/lixiaohuiok111/article/details/34428161
- #!/bin/bash
sudo chmod a+w /opt
cat >>/etc/profile <<EOF
#history
USER_IP=\`who -u am i 2>/dev/null| awk '{print \$NF}'|sed -e 's/[()]//g'\`
if [ "\$USER_IP" = "" ]
then
USER_IP=\`hostname\`
fi
if [ ! -d /opt/history ]
then
mkdir /opt/history
chmod 777 /opt/history
fi
if [ ! -d /opt/history/\${LOGNAME} ]
then
mkdir /opt/history/\${LOGNAME}
chmod 300 /opt/history/\${LOGNAME}
fi
export HISTSIZE=4096
export HISTTIMEFORMAT="%F %T $USER_IP:\`whoami\` "
export HISTFILE="/opt/history/\${LOGNAME}.history"
chmod 600 /opt/history/*history* 2>/dev/null
EOF
source /etc/profile
sudo chmod o-w /opt
USER_IP=`who -u am i 2>/dev/null| awk '{print $NF}'|sed -e 's/[()]//g'`
if [ "$USER_IP" = "" ]
then
USER_IP=`hostname`
fi
if [ ! -d /opt/history ]
then
mkdir /opt/history
chmod 777 /opt/history
fi
if [ ! -d /opt/history/${LOGNAME} ]
then
mkdir /opt/history/${LOGNAME}
chmod 300 /opt/history/${LOGNAME}
fi
export HISTSIZE=4096
export HISTTIMEFORMAT="%F %T $USER_IP:`whoami` "
export HISTFILE="/opt/history/${LOGNAME}.history"
chmod 600 /opt/history/*history* 2>/dev/null
history命令显示出详细时间的更多相关文章
- 让 history 命令显示日期和时间
echo 'HISTTIMEFORMAT="%F %T "' >> /etc/profile source /etc/profile
- 如何让history命令显示最近所执行过的命令的具体执行时间
如何让history命令显示最近所执行过的命令的具体执行时间. 步骤如下: 1.以ROOT用户编辑/etc/profile文件,在里面加入下面内容(我一般习惯在最末尾加): export HISTTI ...
- linux下history命令显示历史指令记录的使用方法
Linux系统当你在shell(控制台)中输入并执行命令时,shell会自动把你的命令记录到历史列表中,一般保存在用户目录下的.bash_history文件中.默认保存1000条,你也可以更改这个值 ...
- linux history命令显示时间
在CentOS上使用history查看历史使用的CMD记录时,发现没有时间,在当前用户的.bash_profile里面,添加 export HISTTIMEFORMAT="%F %T `w ...
- Linux设置history命令显示行数以及时间
Linux和unix上都提供了history命令,可以查询以前执行的命令历史记录但是,这个记录并不包含时间项目因此只能看到命令,但是不知道什么时间执行的如何让history记录时间呢? 解决方案 注意 ...
- Linux设置history命令显示时间
效果如图: 设置方法如下: vim /etc/bashrc #command-->history set HISTFILESIZE=2000 #保存命令的总数默认总数为1000 HISTSIZE ...
- linux下history命令显示执行时间
想在输入history命令之后,显示自己历史的命令执行的时间,需要在用户目录下~/.bashrc的文件末尾追加添加如下几行 之前一直想看一下自己历史命令执行的时间,找了很多教程都没有卵用,最终参考了如 ...
- 如何让linux的history命令显示时间记录
在.bashrc文件追加如下内容即可: HISTFILESIZE= HISTSIZE= HISTTIMEFORMAT='%F %T ' export HISTTIMEFORMAT
- 使history命令显示时间
添加环境变量HISTTIMEFORMAT就行了 # export HISTTIMEFORMAT='%F %T ' .csharpcode, .csharpcode pre { font-size: ...
随机推荐
- [转]10个学习Android开发的网站推荐
本文转自:http://blog.csdn.net/i_lovefish/article/details/43950893 1. Android Developers 作为一个Android开发者,官 ...
- Oracle错误日志:ORA-00257
今天下午刚启动程序,就报以下错误: Caused by: java.sql.SQLException: ORA-00257: 归档程序错误.在释放之前仅限于内部连接. 经查,是oracle数据库日志满 ...
- hihocoder 1388 &&2016 ACM/ICPC Asia Regional Beijing Online Periodic Signal
#1388 : Periodic Signal 时间限制:5000ms 单点时限:5000ms 内存限制:256MB 描述 Profess X is an expert in signal proce ...
- 我的第一篇博客--SQL小语句
开通了博客,拥有了属于自己的小小天地.先写一篇今儿刚学到的 1 remove mirroring relationship alter database datab_name set partner ...
- jQuery对象与dom对象的区别与相互转换
什么是jQuery对象? 就是通过jQuery包装DOM对象后产生的对象.jQuery对象是jQuery独有的,其可以使用jQuery里的方法.例如: $("#test").htm ...
- 关于jQuery的一些实用代码
(1)修改默认编码:(将默认的utf-8,修改为GB2312) $.ajaxSetup({ ajaxSettings:{contentType:"application/x-www-from ...
- Linux搭建python环境
环境: CentOS 6.4 前言:CentOS 6.4系统自带的有python2.6.6版本 一.下载文件 python官网:https://www.python.org/downloads/ 版本 ...
- IO流的练习2 —— 复制单级文件夹中的文件
需求:把C:\Users\Administrator\Desktop\记录\测试里面的所有文件复制到 C:\Users\Administrator\Desktop\新建文件夹\copy文件夹中 分析: ...
- KVM虚拟机网络基础及优化说明
一个完整的数据包从虚拟机到物理机的路径是: 虚拟机--QEMU虚拟网卡--虚拟化层--内核网桥--物理网卡 KVM的网络优化方案,总的来说,就是让虚拟机访问物理网卡的层数更少,直至对物理网卡的单独占领 ...
- poj 1458 Common Subsequence
Common Subsequence Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 46387 Accepted: 19 ...