history

display KornShell command history 

KornShell Built-in


SYNOPSIS

history [-nr] [first [last]]


DESCRIPTION

history displays KornShell commands that you executed previously. These commands make up your command history.

By default, history displays a numbered list of the 16 most recent commands, from earliest to most recent. By specifying values for first and last, you can display a specified range of commands rather than the 16 most recent. For example,

history 1 10

displays commands 1 through 10.

The KornShell stores your command history in the file given by the variable HISTFILE. By default, this is sh_histo (.sh_history on POSIX and UNIX systems). The variable HISTSIZE gives the number of commands kept in the file; if HISTSIZE is not defined, the default is 128.

Options

-n 

displays the commands but not the command numbers.

-r 

displays commands in reverse order, from most recent to earliest.

history is an alias defined with

alias history='fc -l'

For further information, see fc.


ENVIRONMENT VARIABLES

HISTFILE 

contains the path name of the history file.

HISTSIZE 

gives the maximum number of previous commands that are accessible.


DIAGNOSTICS

Possible exit status values are:

0 

Successful completion.

1 

Failure due to any of the following:

— missing history file
— could not find the desired command in the history file
2 

An invalid command line option or argument.


PORTABILITY

POSIX.2. x/OPEN Portability Guide 4.0. All UNIX systems. Windows 10. Windows Server 2016. Windows Server 2019. Windows 11. Windows Server 2022. Windows Server 2025.


NOTE

This is an alias built into the MKS KornShell.


AVAILABILITY

PTC MKS Toolkit for Power Users
PTC MKS Toolkit for System Administrators
PTC MKS Toolkit for Developers
PTC MKS Toolkit for Interoperability
PTC MKS Toolkit for Professional Developers
PTC MKS Toolkit for Professional Developers 64-Bit Edition
PTC MKS Toolkit for Enterprise Developers
PTC MKS Toolkit for Enterprise Developers 64-Bit Edition
PTC Windchill Requirements and Validation


SEE ALSO

Commands:
alias, fc, ghist, r, sh

Using the MKS KornShell


PTC MKS Toolkit 10.5 Documentation Build 40.