We use custom history files which get backed up per user. When someone does a history -c we notice that after they log back in there is history in the buffer again and it seems to come from /root/.bash_history. This adds back in history that we do not want in the buffer, which then rolls into our custom files and skews the data. How can we prevent this from happening? FYI in case it helps the way we login is with our std account, then sudo -i to get root.

1 Answer 1


Your use case isn't clear to me. But as far as I understand you want not to save history between sessions, and that's easy: add unset HISTFILE to ~/.bashrc (that's /root/.bashrc for the history while under sudo -i).

  • I spoke too soon. This is not getting me the desired result. I am going to edit my question so there is no confusion as to what I am looking to do.
    – user53029
    May 25, 2016 at 13:44

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.