When commands are saved to history in Linux, is there some way to prepend the command line in the history with the remote SSH IP address and process ID so that it's easy to group commands from the same SSH session and also see where they were run from? I know how to get the IP address and process ID, but I don't know how to get it to save that to the history.
Is there some way to modify the command line that gets saved to .bash_history or some other way to accomplish this?