Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am trying to increase the size of my history in bash. I have the following in my ~/.bash_profile

# Control the command history
export HISTFILESIZE=10000
export HISTSIZE=10000
export HISTCONTROL=ignoredups:erasedups
But, when I echo $HISTSIZE I always get 50. Am I missing something? Is there some command that my sys admin put in a higher config file that could prevent HISTSIZE from being changed?

share|improve this question

migrated from stackoverflow.com Sep 24 '12 at 13:25

This question came from our site for professional and enthusiast programmers.

    
What happens when you echo $HISTSIZE immediately after you export it? Do you still get 50 in that instance? –  Dunnie Mar 30 '11 at 14:23
    
@Dunnie Good question. ~$ echo $HISTSIZE 50 ~$ export HISTSIZE=100 ~$ echo $HISTSIZE 100 ~$ So I can set the HISTSIZE on the command line, but not in my .bash_profile. –  Jeremy Mar 30 '11 at 14:59
    
And do you get the same output if you place the echo in your .bash_profile? I'm basically trying to determine if your .bash_profile just isn't setting it at all, or if it's getting overwritten later on down the line. –  Dunnie Mar 30 '11 at 15:07
    
@Dunnie Yeah, you were right. One of those files sources something that changes HISTSIZE. I have changed the order of the sourcing of files and now it works. Thanks for your help. –  Jeremy Mar 30 '11 at 17:23

3 Answers 3

up vote 3 down vote accepted

Many distributions seem to have .bash_profile check .bashrc somewhere inside of it. Could your .bashrc be sourced sometime later and set a HISTSIZE of 50?

share|improve this answer
    
I have checked .bashrc and (on this system) .bashrc.local; both are called after .bash_profile, neither contain anything about HISTSIZE. –  Jeremy Mar 30 '11 at 14:59
    
Does your .bash_profile (or any descendants) source any other files? /etc/profile might also be a culprit. –  Miles Strombach Mar 30 '11 at 15:25

Try setting the variables in /etc/environment.

share|improve this answer
    
Putting HISTSIZE=5000 or HISTFILESIZE=5000 in /etc/environment does nothing for me. I'm in Arch Linux. –  trusktr Oct 4 '12 at 4:54
    
Oh, wait, putting the variables in ~/.bashrc or /etc/bash.bashrc works. –  trusktr Oct 4 '12 at 5:46

What is your OS and BASH version? try

echo $BASH_VERSION

I use 4.2.20(2)-releasevia Mac OS X Lion / Homebrew... Here is my config

export HISTIGNORE="ls:ll:cd:pwd"
export HISTFILESIZE=3000
export HISTSIZE=3000
export HISTCONTROL=ignoredups:erasedups
export HISTTIMEFORMAT="[$(tput setaf 6)%F %T$(tput sgr0)]: " # colorful date

Try to update you bash. Also, maybe ~/.bashrc or /etc/bashrcor /etc/profile is overriding your local settings...

share|improve this answer

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.