In order to make the behavior system wide, I put unset HISTFILE in /etc/profile. Normal users no longer have .bash_history but root still does. Anyone can tell me what I am doing wrong here? Or what is another proper place I should use instead of /etc/profile ? There is /root/.bashrc which probably do the trick for root, but I just want this setting in one global place so I can toggle it easily, pogo?


You must take in count the order, how these files apply when user/root logs in. The profile is read first, the ~/.bashrc the last so if you set/unset some variable in the profile, it can be overwritten in the ~/.bashrc of each user. So what you made is like template of the environment, which can be overwritten.

And there are more files you'd better have a look at:

  • content of /etc/profile.d
  • /etc/bash.bashrc

It's better described in this post:


Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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