Ben Sturmfels

Bash history too valuable to lose

Ben Sturmfels at

I've started version controlling my .bash_history, since it feels like my extra memory. Being able to Ctrl-r search everything just lets me remember how to do a whole lot more things without explicitly writing them down and later looking them up. This also allows me to crudely synchronise between development machines every week or so.

McClane, Charles Stanhope, Claes Wallin (韋嘉誠), Tyng-Ruey Chuang and 1 others likes this.

Not a bad plan =)

JanKusanagi at 2018-01-21T02:01:09Z

I have largely replaced aliases or functions in ~/.bash_aliases (called from ~/.bashrc) with just named functions in .bash_history. Version control becomes natural and immediate.

So I just:
$ useful_function() { for blah in blahs; do stuff; done; }; useful_function

And then calling is just C-r useful_fun, and if I need to change something I change it, and then enter and boom, new version.

Claes Wallin (韋嘉誠) at 2018-01-21T02:45:13Z

That's really neat, great idea!

Ben Sturmfels at 2018-01-21T03:04:14Z

@Claes Wallin (韋嘉誠) What happens when you restart the system or log out though, do you just Ctrl-r back to the definition?

Ben Sturmfels at 2018-01-21T03:05:58Z