Nathan Willis

Per-tab bash history revisited

Nathan Willis at

What I'm thinking now is that I'd like each directory where I start a new bash shell to retain its own history file. "Start" being the operative word there. I tend to only keep a few terminal tabs open for long-running usage -- and they tend to adhere to different workflows.

e.g., if I start a shell session in ~/dayjob/ I'm likely to keep to a certain set of related commands. If I start one in ~/fonts/ on ~/design/, then those are two separate sets. ~ itself is kind of general purpose.

Thing is, I'm not sure how to reliably start a tab in a specific directory. I guess GNOME Terminal can do that with "profiles" but I've never used it. Other terminal apps are not going to be compatible, though, and remote login would get left out.

So maybe what I really want is a 'start_history' command that looks in the current directory for a Bash history file, and reads it in if it's there. Or starts a new one if there isn't one. You could trigger that automatically with GT profiles or when logging in over SSH, or just do it manually. Although now that I think of it 'resethistory' would be a cooler-sounding command name.

I'm sure there's problems with that approach, but I'm mostly just thinking out loud. Other loud thoughts on the subject quite welcome.

olm-e likes this.