Korn shell or POSIX shell command history
The Korn shell or POSIX shell saves commands entered from your terminal device to a history file.
If set, the HISTFILE variable value is the name of the history file. If the HISTFILE variable is not set or cannot be written, the history file used is $HOME/.sh_history. If the history file does not exist and the Korn shell cannot create it, or if it does exist and the Korn shell does not have permission to append to it, then the Korn shell uses a temporary file as the history file. The shell accesses the commands of all interactive shells using the same named history file with appropriate permissions.
By default, the Korn shell or POSIX shell saves the text of the last 128 commands for nonroot users and 512 commands for the root user. The history file size (specified by the HISTSIZE variable) is not limited, although a very large history file can cause the Korn shell to start slowly.