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.

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

~/.profile

export HISTSIZE=100000
export HISTFILESIZE=100000

I can access these vars in msys:

user@machine /usr
$ echo $HISTFILE
/c/Users/user/.bash_history

user@machine /usr
$ echo $HISTSIZE
500

user@machine /usr
$ echo $HISTFILESIZE
500

How can I set them permanently?

Thx

share|improve this question

1 Answer 1

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
1  
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. –  bzjywhjm 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

 
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.