1

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

1 Answer 1

0

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
$
3
  • 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.
    – su.root
    Commented Mar 26, 2013 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
    Commented Mar 26, 2013 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
    Commented Mar 26, 2013 at 8:53

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .