------------------------------------------------------- Better Recording of Shell Commands contributed by Scott, sharrison@users.sourceforge.net ------------------------------------------------------- GOAL: Keep track of the time of shell command execution and do not lose command history. RATIONALE: Delivering educational resources to students via educational software is serious business. I recommend this technical tip as a practical way to improve your ability to capture most of the shell commands that would be typically executed on your LON-CAPA server system. Someday, you may need to reconstruct the events and happenings on your Linux operating system over a large historical period. THE SOLUTION: 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.