LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Tags used in this thread
Popular LQ Tags

Reply
 
Thread Tools
Old 02-28-2007, 09:06 AM   #1
cjreeve
LQ Newbie
 
Registered: Feb 2007
Posts: 2
Thanked: 0
how can I record command history with times


[Log in to get rid of this advertisement]
Hello,

I am a student running an experiment remotely on a linux machine. In the event of a problem I need to check what commands I may have sent to the computer (may be weeks in the past) which coincided with the time of the problem.

As well as a record of the commands I sent I also need to record the exact date/time each command was sent and the user that sent the command.

Does any one know of a good way of setting up such a monitoring system?

Cheers,

Chris.

Last edited by cjreeve; 02-28-2007 at 09:29 AM..
cjreeve is offline     Reply With Quote
Old 02-28-2007, 09:24 AM   #2
kaz2100
Senior Member
 
Registered: Apr 2005
Location: Penguin land, with apple, no gates
Distribution: Debian-woody-> sarge-> etch -> lenny -> squeeze
Posts: 1,082
Thanked: 4
Hi,

use tcsh

Happy Penguins!
kaz2100 is offline     Reply With Quote
Old 02-28-2007, 09:28 AM   #3
colucix
Guru
 
Registered: Sep 2003
Location: Bologna, Italia
Distribution: OpenSUSE 11.1 CentOS 5.4 VectorLinux 6.0
Posts: 5,134
Thanked: 465
You can control the behaviour of command history by means of some environment variables. For example
HISTTIMEFORMAT - if set and not null determine the format of timestamp associated to an entry in the history (this is what you are looking for)
HISTFILE - is the name of the file in which command history is saved ($HOME/.bash_history by default)
HISTSIZE - is the max number of entries to store in the history, and so on...
Since you are looking for recording over a long period you may consider to backup the history file on a regular basis. Anyway it is a common practice to empty the history file every time you log out from a remote machine (for security reasons). In this case you may consider to automatically backup the history file every time you logout (e.g. append the current content of .bash_history to a file).

Edit: you can find all information related to history by issuing "info history".

Last edited by colucix; 02-28-2007 at 09:31 AM..
colucix is offline  
Tag This Post
Reply With Quote
Old 02-28-2007, 09:56 AM   #4
cjreeve
LQ Newbie
 
Registered: Feb 2007
Posts: 2
Thanked: 0

Original Poster
Thank you. That has done the trick.

cjreeve is offline     Reply With Quote

Reply

Bookmarks


Thread Tools

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
record CPU history mguleren Linux - General 1 03-10-2006 11:35 AM
History command amer_58 Linux - General 5 06-24-2005 01:26 PM
history clear command suguname Linux - Newbie 5 03-05-2005 10:32 AM
Command history? King4lex Linux - Newbie 4 09-03-2004 09:35 PM
command history log??? granny Linux - Newbie 3 02-11-2003 05:03 PM


All times are GMT -5. The time now is 03:30 PM.

Main Menu
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
RSS2  LQ Podcast
RSS2  LQ Radio
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: @linuxquestions
Open Source Consulting | Domain Registration