cptsalek at gmail.com
Fri Jan 5 08:02:24 UTC 2007
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 at vizion.occoxmail.com> wrote:
> ----- Original Message ----
> From: Bill Moran <wmoran at 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.
More information about the freebsd-questions