14.2 Korn Shell Features
14.2.2 The history command in the Korn shell
The history feature records commands typed in the Korn shell. In the Korn shell, history is automatically set up when the user first enters the shell. Whenever the user types in a command, this function records it on a history list. The history list is stored in the user's home directory in a file named ~/.sh_history. By default, the Korn shell keeps a record of the last 128 commands entered but only displays the last 16 commands by default.
Command Format:
history [options]

Specifying a number preceded by a dash as an option will display that number of lines. Specifying a number without a dash will show the history lines from that number to the last command entered. The Figure shows the listing from the history command. In the first example, using the history command by itself, the last 16 commands are displayed. The second example displays only the last three commands because the -3 option was used.