bash history buffer cache

Moderators,
Please excuse if I am in the wrong section.

I have a question that someone may know the answer to. We know that a current bash shell keeps a record of all commands in a buffer. When the shell is terminated this buffer is written out to ~/.bash_history for the user.

I know that in the current shell, you can access this buffer by using ctrl r for reverse history. That's fine if you are the user in that shell.
The question that I have is:

As root user, can I access that buffer of another shell open on the system? Perhaps in the /proc/pid format of some sort?

Any help is appreciated.

jaysunn

From the outside? No.

You could look at the process' raw memory contents, but that's akin to trying to read a hard drive with an electron microscope.

Since you're root, though, why not just kill their shell, then grab the history?

@corona688,
Yes I could kill the shell and grab the history. Just wondered if a less barbaric approach was available.

Thanks,
jaysunn