Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am using the linux-utility 'screen' (I mean the terminal multiplexer).

In each "window" of screen, I am running bash.

But these bashes do not seem to have any command history.

For example, if I type this in of the bashes within screen:

[gojira@cray]$ date

Mon Jun  6 17:50:51 JST 2011

[gojira@cray]$ grep date ~/.bash_history

[gojira@cray]$

So ./bash_history simply seems to be empty.

Where is the history for each bash within screen stored?

share|improve this question

3 Answers 3

up vote 1 down vote accepted

History is only flushed to file when the shell exits.

Try the history bash built-in for access to more recent command history.

share|improve this answer

The history is saved to $HISTFILE (default ~/.bash_history). If this variable is empty, no history file will be created. The history is saved when the shell is exited, not before.

To test whether your history has been enabled or not, run:

echo "$HISTFILE"
share|improve this answer

You might want to add shopt -s histappend to your .bashrc.

This will append the content of your terminal history to your .bash_history on exit. Otherwise .bash_history will be overwritten on exit. This means that you may loose some of your command history if you're using multiple bash shells at once and close them.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.