LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Capture command line entry with timestamp (https://www.linuxquestions.org/questions/linux-newbie-8/capture-command-line-entry-with-timestamp-162148/)

moxshax 03-25-2004 04:44 AM

Capture command line entry with timestamp
 
Hi guys! Have been working on Redhat 9 for about 6 months. I 'm just wondering, if it's possible to capture command line entries ( bash etc ) into a text file with a timestamp. Of course, it should not capture password and stuff. Is this possible?

Need advice,
Moxsha

jailbait 03-25-2004 08:00 PM

"Hi guys! Have been working on Redhat 9 for about 6 months. I 'm just wondering, if it's possible to capture command line entries ( bash etc ) into a text file with a timestamp. Of course, it should not capture password and stuff. Is this possible?"

You can use the HISTFILE and HISTFILESIZE variables to keep a command log. For example you could put the following commands at the end of your .bashrc file:

HISTFILE=/home/user/command.log
HISTFILESIZE= 10000
export HISTFILE
export HISTFILESIZE

and bash will keep the last 10000 commands in /home/user/command.log. I do not know how to time stamp the commands. I think that bash would not have such an option because altering the commands would make them unreusable and defeat the main purpose of the bash history file.

You already have such a file in .bash_history and you can call up your previous commands with up arrow.

___________________________________
Be prepared. Create a LifeBoat CD.
http://users.rcn.com/srstites/LifeBo...home.page.html

Steve Stites

crypto2phreak 03-26-2004 01:00 AM

omg where did it go
 
omg where did it all go

verstapp 03-26-2004 03:31 AM

you might also try the script command.


All times are GMT -5. The time now is 09:38 AM.