LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 03-25-2004, 04:44 AM   #1
moxshax
LQ Newbie
 
Registered: Mar 2004
Posts: 1

Rep: Reputation: 0
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
 
Old 03-25-2004, 08:00 PM   #2
jailbait
LQ Guru
 
Registered: Feb 2003
Location: Virginia, USA
Distribution: Debian 12
Posts: 8,333

Rep: Reputation: 547Reputation: 547Reputation: 547Reputation: 547Reputation: 547Reputation: 547
"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
 
Old 03-26-2004, 01:00 AM   #3
crypto2phreak
LQ Newbie
 
Registered: Mar 2004
Posts: 14

Rep: Reputation: 0
omg where did it go

omg where did it all go
 
Old 03-26-2004, 03:31 AM   #4
verstapp
Member
 
Registered: Feb 2004
Location: canberra australia
Distribution: Suse 9.0
Posts: 44

Rep: Reputation: 15
you might also try the script command.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Screen capture using Mplayer command line lovalixir Linux - Software 1 12-04-2005 07:57 PM
Timestamp of previous command issued benjaminrtz Linux - General 1 04-16-2005 01:53 AM
shell timestamp command lowspeed Linux - General 2 02-17-2005 04:19 PM
Command to output file content line by line aznluvsmc Programming 2 09-12-2004 07:45 PM
Tcl/Tk - command < entry > question. liguorir Linux - Software 0 05-06-2004 10:36 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 10:43 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration