|
|||||||
| Forums | Search Forums | Register | Forum Rules | Man Pages | Albums | FAQ | Members | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
|
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
||||
|
||||
|
HISTSIZE and HISTFILESIZE
Hi
Whats the exact difference between HISTSIZE and HISTFILESIZE in bash shell? Thanks |
| Sponsored Links | ||
|
|
#2
|
||||
|
||||
|
Code:
man bash Code:
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. |
| Sponsored Links | ||
|
|
#3
|
|||
|
|||
|
Read the question properly
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. |
|
#4
|
||||
|
||||
|
Code:
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. |
| Sponsored Links | |
|
|
#5
|
|||
|
|||
|
@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. |
| Sponsored Links | ||
|
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| HISTSIZE environment variable problem | Kenneth2006 | UNIX for Advanced & Expert Users | 5 | 01-17-2006 08:57 AM |
|
|