Chinaunix首页 | 论坛 | 博客
  • 博客访问: 285121
  • 博文数量: 84
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: -10
  • 用 户 组: 普通用户
  • 注册时间: 2016-07-05 09:11
文章分类
文章存档

2015年(1)

2014年(6)

2013年(8)

2012年(1)

2011年(6)

2010年(2)

2009年(16)

2008年(44)

我的朋友

分类:

2008-05-01 12:43:16

将历史记录追加到一个文件
 
将以下代码加入/etc/profile /etc/bashrc
 
export PROMPT_COMMAND='{ date "+[ %Y%m%d %H:%M:%S `whoami` `tty`] `history 1 | { read x cmd; echo "$cmd"; }`"; } \
     >> /var/log/jhf_p_history'
 
 
chmod 766 jhf_p_history
 
/etc/profile每次登陆都执行一次
 
/etc/bashrc 用户登陆时候执行用户宿主目录下面执行.bash_profile  .bash_profile调用.bashrc
bashrc调用/etc/bashrc
 
[root@localhost ~]# cat .bash_profile
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi
# User specific environment and startup programs
PATH=$PATH:$HOME/bin
export PATH
unset USERNAME
[root@localhost ~]# cat .bashrc
# .bashrc
# User specific aliases and functions
alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'
# Source global definitions
if [ -f /etc/bashrc ]; then
        . /etc/bashrc
fi
阅读(645) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~