Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

the default size of history in Ubuntu is 1000 but it's too narrow,I want to change it to 10000, So I append export HISTSIZE=10000 export HISEFILESIZE=10000 to .bash_profile(it actually is .profile in 12.04), and 'source' it source .profile then I input echo $HISTSIZE echo $HISTFILESIZE 1000 was displayed for both,but I reboot my computer it went 'default' How it doesn't work?

share|improve this question

I tried the same thing, only to discover that sneaky Ubuntu sets these variables in ~/.bashrc by default, which is executed instead of ~/.profile for non login shells such as just opening a terminal window. Changing these lines in ~/.bashrc fixed it for me:

# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
share|improve this answer
hisfilesize is in KB? – duckx Jul 31 '14 at 14:21
@duckx No, HISTFILESIZE is in number of line stored in the history file, while HISTSIZE is the number of line stored and available by each shell process (and then saved to HISTFILESIZE). Note that with no value (or non-number, or negative), then no limiting occurs. – vaab Jan 23 '15 at 2:01
This does not work for some reason on XFCE Terminal – Michal Przybylowicz Dec 30 '15 at 11:50

From the Bash Reference Manual:

    The maximum number of commands to remember on the history list.

    If the value is 0, 
       **commands are not saved** in the history list. 

    Numeric values less than zero result in 
       every command being saved on the history list (there is no limit). 

So for an infinite history list, make:
HISTSIZE=(some number less than 0)

    The maximum number of lines contained in the history file. 

    When this variable is assigned a value, 
        the history file is truncated, if necessary, 
        to contain no more than that number of lines 
        by removing the oldest entries. 

        The history file is also truncated to this size after 
        writing it when a shell exits. 

    If the value is 0, 
        **the history file is truncated to zero size.** 

    Non-numeric values and numeric values less than zero 
        inhibit truncation. 

So for an infinite .bash_history history file, make:
HISTFILESIZE=(some number less than 0)

share|improve this answer

Your Answer


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.