File:  [LON-CAPA] / doc / techtips / record_shell_commands.txt
Revision 1.1: download - view: text, annotated - select for diffs
Fri Feb 1 14:21:31 2002 UTC (22 years, 3 months ago) by harris41
Branches: MAIN
CVS tags: version_0_4, stable_2002_spring, stable_2002_july, stable_2002_april, STABLE, HEAD
how to record the times and increase the history file size for
bash shell commands

    1: Better recording of shell commands
    2: 
    3: GOAL: Keep track of the time of shell command execution
    4: and do not lose command history.
    5: 
    6: The following solution works well for me
    7: on many of my servers.
    8: 
    9: 1. cp /etc/profile /etc/profile.orig
   10: 2. Edit /etc/profile
   11: 3. diff /etc/profile /etc/profile.orig
   12: [root@zaphod root]# diff /etc/profile /etc/profile.orig 
   13: 32,36c32
   14: < HISTSIZE=1000000000
   15: < HISTFILESIZE=1000000000
   16: < HISTDATE=`date`
   17: < 
   18: < echo "Commands below this line occur after $HISTDATE" >> $HOME/.bash_history
   19: ---
   20: > HISTSIZE=1000
   21: 42c38
   22: < export PATH USER LOGNAME MAIL HOSTNAME HISTSIZE HISTFILESIZE INPUTRC
   23: ---
   24: > export PATH USER LOGNAME MAIL HOSTNAME HISTSIZE INPUTRC
   25: 
   26: NOTE: /etc/profile is many times called twice, so there are two
   27: lines "Commands below this line"... entered into .bash_history.
   28: 
   29: This is the best solution I have found aside from altering
   30: the bash source code and recompiling bash.
   31: 

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>