My use of the command line changed dramatically once I discovered
screen. Guake is a GUI interface that lets you open and run many terminals
easily. Screen provides a similar service from the command line itself within a
single terminal, which makes it extremely useful for working with remote
But, when you have all of those terminals going at once, bash's regular way of
tracking what commands you've used (by storing everything to
seems to break down. This is bad for reconstructing what you've done at some
later point in time. Fortunately, we can configure bash to do better. To do so,
add these lines to your
export HISTTIMEFORMAT="%s " export HISTFILE=~/.history/history_`date +"%Y-%m-%dT%H:%M:%SZ"`_$$ export HISTFILESIZE= export HISTSIZE=500
HISTTIMEFORMATappends a unix epoch timestamp before each command in the history files, which is useful for reconstructing what you've done.
HISTSIZEchanges the maximum number of commands available through the history command.
HISTFILESIZEchanges the maximum size of your
HISTFILE. If you don't set it, the
HISTFILEwon't be truncated at all.
HISTFILEsets the name of the history file. We give each file a name including the current ISO8601 time
date +"%Y-%m-%dT%H:%M:%SZ"and the process id of the shell
$$(in case two shells are launched in the same second).
A similar strategy for working this is to add
shopt -s histappend
~/.bashrc. This tells bash to append to the history file rather than
overwriting it when the shell exits. The disadvantage to this is that then all
of history is stored in one enormous file.