Unix administration - shell history - date + time ?

This is Interesting: Free IT Magazines  
Home > Archive > Unix administration > October 2006 > shell history - date + time ?





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author shell history - date + time ?

2006-10-03, 1:20 pm

Anyone got a setting or script that would dated/time the commands in ksh/bash history ?
This isn't for security purpose so I am not looking for audit style logging...
TIA.
Chris F.A. Johnson

2006-10-03, 7:29 pm

On 2006-10-03, <unknown@display.homeunix.org> wrote:
> Anyone got a setting or script that would dated/time the commands in ksh/bash history ?
> This isn't for security purpose so I am not looking for audit style logging...


man bash:

HISTTIMEFORMAT
If this variable is set and not null, its value is used as a
format string for strftime(3) to print the time stamp associated
with each history entry displayed by the history builtin. If
this variable is set, time stamps are written to the history
file so they may be preserved across shell sessions.

--
Chris F.A. Johnson, author | <http://cfaj.freeshell.org>
Shell Scripting Recipes: | My code in this post, if any,
A Problem-Solution Approach | is released under the
2005, Apress | GNU General Public Licence

2006-10-04, 1:22 pm

Chris F.A. Johnson <cfajohnson@gmail.com> wrote:
> On 2006-10-03, <unknown@display.homeunix.org> wrote:
[vbcol=seagreen]
> man bash:


> HISTTIMEFORMAT
> If this variable is set and not null, its value is used as a
> format string for strftime(3) to print the time stamp associated
> with each history entry displayed by the history builtin. If
> this variable is set, time stamps are written to the history
> file so they may be preserved across shell sessions.


This seem to be effective only for bash version 3.x ...
However, using it to search showed something related with PROMPT_COMMAND which might work.
Thanks.


> --
> Chris F.A. Johnson, author | <http://cfaj.freeshell.org>
> Shell Scripting Recipes: | My code in this post, if any,
> A Problem-Solution Approach | is released under the
> 2005, Apress | GNU General Public Licence

Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com