LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > 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


Reply
  Search this Thread
Old 02-28-2007, 08:06 AM   #1
cjreeve
LQ Newbie
 
Registered: Feb 2007
Posts: 2

Rep: Reputation: 0
how can I record command history with times


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 08:29 AM.
 
Old 02-28-2007, 08:24 AM   #2
kaz2100
Senior Member
 
Registered: Apr 2005
Location: Penguin land, with apple, no gates
Distribution: SlackWare > Debian testing woody(32) sarge etch lenny squeeze(+64) wheezy .. bullseye bookworm
Posts: 1,832

Rep: Reputation: 108Reputation: 108
Hi,

use tcsh

Happy Penguins!
 
Old 02-28-2007, 08:28 AM   #3
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983
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 08:31 AM.
 
Old 02-28-2007, 08:56 AM   #4
cjreeve
LQ Newbie
 
Registered: Feb 2007
Posts: 2

Original Poster
Rep: Reputation: 0
Thank you. That has done the trick.

 
  


Reply

Tags
history



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

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 02:50 AM.

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