The (uneventful) quest to find bashrc


Today I got an idea. I remembered that I had a bashrc lying around with a very specific function: I had somehow set it up not only to save shell history only for the current session, I also had some useful scripts in it.

I thought, "I must have this somewhere in one of my VMs", right? So I looked, and looked. I looked through all the Linux VMs I had, but didn't find what I needed.

I realised that I would have to look at my laptop to find it. This in and of itself would not have been a big deal; I would just have to charge it up, turn it on, and get the files.

After having charged it enough that it would stay on for at least 10 minutes, I turned the beast on and was greeted with the busted screen whose repairing I have procrastinated for months -- understandably so, I have absolutely no experience in tech repair.

When the laptop greeted me with the sign-in screen, I had a small shock moment as I realised that I had no idea if I could remember my password. Luckily, I just put my fingers on the keyboard and let the muscle memory, trained from the last two years, take over, and I was in.

Now that I had copied the files, I installed and examined them on my machine.

Here is my best guess at explaining what I was doing, as I don't exactly know anymore either.

The part that makes the session-only history seems to be this:

unset HISTFILE

This teeny-tiny sliver of code has the very convenient effect that your bash history is always clean and only the recent commands are there. Typing `history` won't give you a mile-long wall of code anymore.

Though I do think that on systems where you might still need some command from months ago, like how I am experiencing ~team currently, it might be a better idea to keep things as they are. Thus, my main machine is going to be the only one that gets this mod.

tags:
bash