Some days ago I was executing a rather long command using Guake (downloading a website with wget, with an intricate set of options). I suspended my laptop before the operation was finished, and did not use it for a few days. Unfortunately, my battery discharged. After logging in again, the command does not appear in the .bash_history file, so it does not show up in Guake or another terminal when using .

Is there a way I can recover this command? Is it perhaps written somewhere else? There seems to be no equivalent to bash history in the Guake folder.

  • I guess there is no way to recover them – Arpit Agarwal Nov 11 '17 at 20:55

No, there probably is no way for you to recover that command. By default, the ~/.bash_history file is written to only when you exit your shell session. Here is a relevant passage from the Bash Manual:

When a shell with history enabled exits, the last $HISTSIZE lines are copied from the history list to the file named by $HISTFILE. If thehistappend shell option is set (see Bash Builtins), the lines are appended to the history file, otherwise the history file is overwritten. If HISTFILE is unset, or if the history file is unwritable, the history is not saved. After saving the history, the history file is truncated to contain no more than $HISTFILESIZE lines. If HISTFILESIZE is unset, or set to null, a non-numeric value, or a numeric value less than zero, the history file is not truncated.

That said, there are things you can do if you want to avoid this situation from occurring in the future. You may want to add something like the following to your ~/.bash_profile:

shopt -s histappend
export HISTSIZE=-1
PROMPT_COMMAND='history -a;history -n'

For further discussion of this topic, see the following posts:

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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