I've meanwhile managed to keep my history a lot cleaner thanks to you guys' great tips involving the
HISTIGNORE option in
.bashrc, omitting all those pointless
df -k lines.
However, I've learned as well that the
HISTIGNORE option is very restrictive, too.
For instance, if you have a line like this (simplified)
you will not only get these to be left out of the list, but also out of your "live history" as I'd like to dub the volatile history you can access via Cursor up/Cursor down. Try it out: they will be entirely omitted now, no matter how long you cycle through your command history with said cursor keys.
However, sometimes I do need these lines, especially with very long and complicated paths which I don't want to retype. On the other hand, I'd like to have these lines exclusive to my live history and not have them stored in the history list as they will change frequently.
Is there any way to accomplish this?
As another side note, I've figured out that for some reason, the "live" history and the history list would sometimes differ a lot (cf. Why do I get different results with the same user and the history command).