Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

On my Debian VM I'm setting the $HISTSIZE and $HISTFILESIZE (and other history related environment variables) on system start / profile load:


export HISTSIZE=100000
export HISTFILESIZE=100000

I can access these vars in msys:

user@machine /usr
$ echo $HISTFILE

user@machine /usr
$ echo $HISTSIZE

user@machine /usr

How can I set them permanently?


share|improve this question
up vote 0 down vote accepted

Bash would ignore ~/.profile if ~/.bash_profile exists. So you need to check if .bash_profile is there. And to be safe, you better configure all these settings in .bashrc and source it in .profile. For example:

$ cat ~/.bash_profile
[[ $- == *i* ]] || return0
source ~/.bashrc
$ cat ~/.bashrc
[[ $- == *i* ]] || return 0
export HISTSIZE=100000
export HISTFILESIZE=100000
share|improve this answer
From bash's manual: When bash is invoked as an interactive login shell, or as a non-interactive shell with the --login option, it first reads and executes commands from the file /etc/profile, if that file exists. After reading that file, it looks for ~/.bash_profile, ~/.bash_login, and ~/.profile, in that order, and reads and executes commands from the first one that exists and is readable. ... ... When an interactive shell that is not a login shell is started, bash reads and executes commands from ~/.bashrc, if that file exists. – whjm Mar 26 '13 at 1:58
Thank you for your answer! But what you are describing is the Linux Bash. It works fine. What doesn't work is to set the HIST* options for my msys command line on Windows. It only has a .bash_history file in the user home folder ~/ -- no .profile and no .bash_profile. – automatix Mar 26 '13 at 8:47
A added the files .bash_profile and .bashrc with the code from your post to my home directory and it works! Thank you! – automatix Mar 26 '13 at 8:53

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.