History file

Hi Experts,

Need your help in understanding the configurations related to history file.

I have few questions regarding this.

(i) Where I can configure the file in which command history would be stored.
On my hp-ux box, for one user history is stored in .history file whereas for other users it is stored in .sh_history file.

(ii) When I execute command

prod:root# echo ${HISTSIZE}
100
prod:root#

However

prod:root# wc -l .sh_history
223 .sh_history
prod:root#

I am not able to understand why 223 commands are stored in .sh_history file whereas HISTSIZE env variable is set to 100 only.
Are there any configurations available which will overwrite the HISTSIZE env variable?

(iii)Is there any configs/commands available that will store the timestamp along with the command executed in the history file?

The standard in HP-UX would be e.g

HISTFILE=$HOME/.sh_history
HISTSIZE=18432
export HISTFILE HISTSIZE

in your .profile
But now you see its just variables, nothing is going to stop you to use something else...

Hi Vbe..

Thanks for the reply.

I checked the .profile file.

Its contents are pasted below.

prod:root:/# more .profile |grep HIST
export HISTSIZE=100
export HISTFILE=${HOME}/.sh_history
prod:root:/#

HISTSIZE mentioned here is 100 only but still .sh_history file contains more than 200 commands.

The Shell History file is not a text file and is unsuitable for reading with the wc command. All you'll get is a count of the number of line-feed characters it finds.
Also see the manual description for HISTSIZE for whichever Shell you are using. It does not imply that the figure is exact.

The user with a history file called .history is probably running csh rather than the more usual sh or ksh .