Friday, June 20, 2014

Flush your bash command history

Lose your terminal session? Did your VPN drop? Did you have a bunch of work you were doing in your bash session and because you lost connection, your session closed uncleanly and you wanted to retrieve your command history?

Yeah. Sucks, huh?

Here's a simple fix:

insert the following in your ~/.bashrc :

# vi ~/.bashrc

export PROMPT_COMMAND='history -a'

and resource:

# .~/.bashrc


Now your commands will "flush" to the history file immediately.

You're welcome.


No comments: