3 ms·
I do something similar, I gave up on trying to get the bash history to work properly and so just have this: echo "$HOSTNAME $$ $(date "+%Y-%m-%dT%H:%M:%S%z
by misnome 6y ago
I do something similar, I gave up on trying to get the bash history to work properly and so just have this:
echo "$HOSTNAME $$ $(date "+%Y-%m-%dT%H:%M:%S%z") $*" >> ~/.fullhistory
It's attached to the preexec hook of https://github.com/rcaloras/bash-preexec https://github.com/rcaloras/bash-preexec, so is run before every command. This means that everything goes into one easily-greppable file, but is still separable by PID/host machine - since my work has me walking around a large facility, often I'll remember where I was when I did something but not exactly when, so can narrow down by machine.