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, 2 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

Better recording of shell commands

GOAL: Keep track of the time of shell command execution
and do not lose command history.

The following solution works well for me
on many of my servers.

1. cp /etc/profile /etc/profile.orig
2. Edit /etc/profile
3. diff /etc/profile /etc/profile.orig
[root@zaphod root]# diff /etc/profile /etc/profile.orig 
32,36c32
< HISTSIZE=1000000000
< HISTFILESIZE=1000000000
< HISTDATE=`date`
< 
< echo "Commands below this line occur after $HISTDATE" >> $HOME/.bash_history
---
> HISTSIZE=1000
42c38
< export PATH USER LOGNAME MAIL HOSTNAME HISTSIZE HISTFILESIZE INPUTRC
---
> export PATH USER LOGNAME MAIL HOSTNAME HISTSIZE INPUTRC

NOTE: /etc/profile is many times called twice, so there are two
lines "Commands below this line"... entered into .bash_history.

This is the best solution I have found aside from altering
the bash source code and recompiling bash.


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