There are actually separate environment variables for the length of the history list in the shell (HISTSIZE), and the number of commands stored in .bash_history on exit(HISTFILESIZE), so you might want to set both of these. From
man bash:
Code:
HISTFILESIZE
The maximum number of lines contained in the history file.
When this variable is assigned a value, the history file is
truncated, if necessary, by removing the oldest entries, to
contain no more than that number of lines. The default value
is 500. The history file is also truncated to this size
after writing it when an interactive shell exits.
HISTSIZE
The number of commands to remember in the command history
(see HISTORY below). The default value is 500.
For shell variables, you only add the $ symbol when you are accessing the value stored (dereferencing). To assign a value to a variable, you use the name on its own:
VARIABLE=value # set the value
echo $VARIABLE # access it again
To then make a variable into an environment variable, you need to export it (which again uses the name on its own):
export VARIABLE
To set environment variables permanently for user(s), you can add the assignment and export statements to one of the following files:
- /etc/profile - sets defaults for all users
- /home/<username>/.profile - read when a user logs in, used by all shells (not just bash)
- /home/<username>/.bashrc - read whenever a new bash session is started, but used only by bash
Changes might not take effect until you've logged out and in again.
Is that any clearer?
Rob