Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

How can I set HISTSIZE for all users on Ubuntu 10.04?

I've tried adding the following lines to both /etc/profile and /etc/bash.bashrc. I'm not sure I understand the difference between the two files but I really think either one should work on an interactive shell, right?

export HISTCONTROL=erasedups:ignorespace
export HISTSIZE=5000
shopt -s histappend

For some reason this won't work though. I have added the lines to the bottom, logged out, logged back in, and typed echo $HISTSIZE and I get "1000"?

What am I doing wrong?

share|improve this question
4  
the default ubuntu ~/.bashrc sets HISTSIZE to 1000. ~/.bashrc has precedence over /etc/bash.bashrc. check your ~/.bashrc, and those of all other users too. –  lesmana Dec 9 '11 at 6:36
    
I originally set it in ~/.bashrc for my user, but then decided I wanted to change it for all users. I removed it from ~/.bashrc but am still not having much luck getting it to load globally. –  cwd Dec 9 '11 at 13:07
add comment

1 Answer

Thanks @lesmana, you are correct. I have added the block of code to /etc/bash.bashrc and made sure it was not in any of the users profiles. That worked well. I also realized that I should set it in /etc/bash.bashrc and not /etc/profile because the first one is for bash (which history is pertinent to) and the second one is for Bourne shell (sh(1)) and Bourne compatible shells (bash(1), ksh(1), ash(1), ).

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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