Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 5 Jan 2007 09:02:23 +0100
From:      "Christian Walther" <cptsalek@gmail.com>
To:        Vizion <vizion@vizion.occoxmail.com>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: Clutz-Proof Logging
Message-ID:  <14989d6e0701050002l56eb3867n2f58de67201e5064@mail.gmail.com>
In-Reply-To: <20070104163203.JLAW60.dukecmmtao03.coxmail.com@dukecmmtao03>
References:  <20070104163203.JLAW60.dukecmmtao03.coxmail.com@dukecmmtao03>

next in thread | previous in thread | raw e-mail | index | archive | help
I'll try to follow up to two posts instead of replying twice, so I
hope nobody gets confused here. :-)

On 04/01/07, Vizion <vizion@vizion.occoxmail.com> wrote:
> ----- Original Message ----
> From: Bill Moran <wmoran@collaborativefusion.com>
>
> >Many shells keep a history as a matter of normal operation.  You might
> >find that enough for you.  Personally, I use bash, and the command
> >"history" brings the last 100 commands or so.
>
> No, this isn't sufficient. The problems are:
> 1) occasionally the sysadmin people at the server farm do stuff
> 2) sometimes I edit files, and of course the shell doesn't record how
> 3) the shell history seems erratic! It remembers the session clearly, but if I reboot, for example, and look at the history, it's not what I would
>  expect it to be.

The history function of many modern shell is configurable. The number
of commands being saved can be changed, as well as the behaviour
regarding different ttys (so you might have different histories for
different ttys you're coming from).
The history function uses a file, so you rely on this file being
written to disk. In case you reboot the machine it's possible that the
history of the current session is lost.

Take a look at the "script" command. It saves a typescript of
everything being typed during a terminal session. So you've got your
own copy without the need of a working and reliable history.

And as Richard Lynch suggests it, using a versioning system like CVS
or SVN might be a good idea.

Or, as a simpler aproach: Just create a backup of a file before you
touch it, for example by copying it to someplace else, and/or by
adding a timestamp.

> I am not certain if you are using X or console.
>
> On X windows you can set the size of the history to your liking - I usually set to unlimited. Then, as frequently as one wishes, save the session to a log file. I have not found any problem with history not being the "history".

Are you talking about X windows or KDE or GNOME? Normally, any x based
terminal executes a shell, so the history is still controlled by the
shell being used. If you're using Konsole or gnome-terminal, it's
possible that you can configure the history somewhere in the terminals
gui, but in this case the terminal sends the apropriate commands to
configure the history.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?14989d6e0701050002l56eb3867n2f58de67201e5064>