HISTFILE
The name of the file in which command history is saved
(see HISTORY below). The default value is
~/.bash_history. If unset, the command history is not
saved when an interactive shell exits.
HISTFILESIZE
The maximum number of lines contained in the history
file. When this variable is assigned a value, the his-
tory 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.
Dude, you didn't answer the actual question. Try reading it again.
The question was what is the difference between HISTSIZE and HISTFILESIZE.
The OP is right, the bash man page is somewhat confusing, it states:
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.
which sound kinda similar.
pandeesh - the answer is you can use either if you want to increase the number of items in your history; however HISTFILESIZE refers specifically to the actual history file itself (e.g. ~/.bash_history) which is written when the shell exits. HISTSIZE refers specifically to history as saved in memory.
These 2 Users Gave Thanks to King Clarity For This Post:
HISTSIZE --> number of lines of command to store in history "list" (memory)
HISTFILESIZE --> number of lines of command to store in history "file"
The history "file" is not updated as you type the commands. The commands get stored in a "list" separately (accessed by the history command). The number of these stored commands is controlled by HISTSIZE value. When the shell (interactive) exits, the last $HISTSIZE lines are copied/appended to $HISTFILE from that "list". If HISTFILESIZE is set, then after this operation, it is ensured that only $HISTFILESIZE lines (latest) exist in $HISTFILE. And when the shell starts, the "list" is initialized from $HISTFILE upto a maximum of $HISTSIZE commands.
@King_Clarity
Please do not respond to 2-month old posts unless you have something new to add. The O/P @pandeesh is known to rarely read and understand man pages.
Hi All,
I am connecting to a sun solaris 5.9 unix (korn shell) server using the x terminal. There is some problem with the HISTORY File where the HISTSIZE env variable is not working. Although the HISTSIZE is set to 20 already but the HISTORY file keep increasing and exceeded the size.
There... (5 Replies)