Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers


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 !!

Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 06-25-2012
pandeesh's Avatar
Registered User
 
Join Date: Jul 2011
Posts: 312
Thanks: 75
Thanked 12 Times in 12 Posts
HISTSIZE and HISTFILESIZE

Hi

Whats the exact difference between HISTSIZE and HISTFILESIZE in bash shell?

Thanks
Sponsored Links
    #2  
Old 06-25-2012
itkamaraj's Avatar
^Kamaraj^
 
Join Date: Apr 2010
Posts: 3,025
Thanks: 33
Thanked 647 Times in 625 Posts

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  
Old 08-25-2012
Registered User
 
Join Date: Aug 2012
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
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  
Old 08-25-2012
elixir_sinari's Avatar
Gotham Knight
 
Join Date: Mar 2012
Location: India
Posts: 1,372
Thanks: 87
Thanked 476 Times in 456 Posts

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  
Old 08-29-2012
methyl methyl is offline Forum Staff  
Moderator
 
Join Date: Mar 2008
Posts: 6,388
Thanks: 286
Thanked 668 Times in 640 Posts
@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
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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



All times are GMT -4. The time now is 11:37 PM.