The scope of shell history

August 3, 2007

One of the little divides in Unix is the one between people who set up their shell to have a per-shell command history (a local history) and the people who set their shell up to use a global history.

While I know perfectly sane and sensible people who are in the global history camp, I am firmly on the local history side, because to me my shell history is contextual. When I hit cursor up or tell a shell to redo the last command, I want it to do redo the command that is right there in that window; I do not want it to redo the last command I did anywhere. (In fact, I doubt I could keep track of the last command I did.)

I suspect that a lot of sysadmins will fall into the local history side. Sysadmins operate in so many different contexts, some of which are split apart by necessity and cannot be joined, so it's very hard to have a truly global history that covers every command, on every machine, as every user. My guess is that once people start working with only semi-global history that they will prefer to go whole hog to local history.

Although I don't know if any shell supports it, there is an intermediate option: maintain both a local history and a common global history, but only look at the global history if the local history is exhausted. That way you keep local context but also get to pull back that neat ad-hoc pipeline you came up with two days ago in a window that you have long since closed down.

(Before you tell me about it, this is not quite what bash does; it freezes the 'global' history the moment you start it. Bash uses its own hybrid model that makes my head hurt.)

Written on 03 August 2007.
« Using WSGI for performance tuning
Weekly spam summary on August 4th, 2007 »

Page tools: View Source, Add Comment.
Login: Password:
Atom Syndication: Recent Comments.

Last modified: Fri Aug 3 23:13:46 2007
This dinky wiki is brought to you by the Insane Hackers Guild, Python sub-branch.