I have read the history command help page and tried both of the options(n& r). As far as I understand, both options ensure that the history file is read and valid in the current shell, so it does the same thing. I wonder what makes it different?

-n   Append the history lines not already read from the history file 
        to the current history list. These are lines appended to the 
        history file since the beginning of the current Bash session. 

-r   Read the current history file and append its contents to the history list. 

1 Answer 1


The -r appends the whole file, -n only appends the lines that were added to it since the start of the session.

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.