Operating System - HP-UX
1820477 Members
2925 Online
109624 Solutions
New Discussion юеВ

Difference between export HISTORY & export HISTSIZE

 
Nikee Reddy
Regular Advisor

Difference between export HISTORY & export HISTSIZE

Hello,

What is the "Difference between export HISTORY & export HISTSIZE" ?

Thanks,
Nikee
7 REPLIES 7
John Palmer
Honored Contributor

Re: Difference between export HISTORY & export HISTSIZE

See 'man sh-posix'

HISTSIZE is the number of previous commands maintained in HISTFILE.

Don't know of HISTORY but HISTFILE is the name of the file that the shell uses to keep your previous commands in. Do you mean HISTFILE?

Regards,
John
Shannon Petry
Honored Contributor

Re: Difference between export HISTORY & export HISTSIZE

I have never used HISTSIZE, and am not really sure that it's supported on HP-UX. I remember a long time ago reading that it maintained bytes of history instead of lines.

HISTSIZE=1024 would maintain 1K of history.

This was during the time the Sun Sparc 2's were being shipped.

Honestly, I dont even remember what OS it was on, Aix 3? Solaris 2.1? I didnt even work with HP-UX back then... ;(


Regards,
Shannon
Microsoft. When do you want a virus today?
Robert-Jan Goossens
Honored Contributor

Re: Difference between export HISTORY & export HISTSIZE

Hi Nikee,

Quote sunsolve

Problem Description

C shell and Korn shell only save one copy of a command history file.
When I exit a window manager like OpenWindows and CDE, only the command
history of the last shell to exit is saved. How can I save the command
histories from all of my shells when I exit the window manager?
Keywords: shell, history, window, manager

Problem Solution

Solaris' C shell and Korn shell are designed to write a user's command history
to a single file ($HOME/.history for C shell and $HOME/.sh_history or HISTFILE
for Korn shell), when they exit. When a user runs mutiple C shells or Korn
shells within a window manager such as OpenWindows or CDE, only the command
history of the last shell to exit is written to the history file. And
the last shell to exit is the shell that started the window manager, so none
of the commands executed by the user in shells within the window manager are
saved.

A public domain shell called tcsh (an enhanced C shell) allows the user to
merge the command histories of multiple tcsh shells into a single history
file. To use it, do the following:

1. use tcsh as the user's login shell
2. in the user's .cshrc or .tcshrc file, add the following entries:

set history = [positive number, indicating number of commands to buffer]
example: set history = 200

set savehist = ( [number of commands to save to histfile] merge )
example: set savehist = ( 200 merge )

The 'merge' literal is specific to the tcsh shell: it is not part of the
C shell or Korn shell. It directs all tcsh shells to merge their command
histories into a single history file (if no history file is specified, the
default file is $HOME/.history) instead of overwriting the file. The
merge literal allows all of the command histories from all open tcsh shells
to be recorded in one file, sorted by time stamp.

NOTE that tcsh is a public domain application, not a Sun product therfore Sun
does NOT support it. This information is only provided as a helpful suggestion
to customers who desire the ability to save multiple shell command histories.
Sun does not support the tcsh shell, or problems caused by use of the tcsh
shell, in any way.

end quote

it's a free document.

Kind regards,

Robert-Jan.
Steve Labar
Valued Contributor

Re: Difference between export HISTORY & export HISTSIZE

In C shell, history can be set to a positive integer and the shell will remember that many commands. The .history file is not necessarily required. However, if you do not have the .history file, you can only get the history of the current shell and cannot use a previous command in a different shell (window).

Hope this helps.

Steve
Madhu Byreddy
New Member

Re: Difference between export HISTORY & export HISTSIZE

Hi Nikee only

This message is nothing to do with the subject. If yor are from Rly Kodur, India, please e-mail me on mbyreddy@hotmail.com.

Please ignore this msg, if it is not relavent to you.

Cheers
Madhu
Bill Hassell
Honored Contributor

Re: Difference between export HISTORY & export HISTSIZE

AS mentioned, the man page for sh-posix as well as the man page for ksh describe the HISTFILE and HISTSIZE environment variables. To enable command recall, only HISTFILE needs to be defined, typically it is done in /etc/profile so all users will benefit. And to ensure the expected behavior for recall, be sure to eport EDITOR too. This is typical for /etc/profile:

export HISTFILE=$HOME/.sh_history
export HISTSIZE=500
export EDITOR=/usr/bin/vi

Note that in the POSIX shell for HP-UX, root must have the .sh_history file manually created for the first time, while ordinary users will have their .sh_history file created automatically.


Bill Hassell, sysadmin
??_29
Advisor

Re: Difference between export HISTORY & export HISTSIZE

Hi Nikee
HISTSIZE is the environment variable used to count the numbers that history command can be remembered by POSIX shell.
No HISTORY variable.