Korn Shell

  • The default size of the history file is 500 lines for root and 128 lines for other users.
  • The history file does not record what date/time commands were run.

Commands

  • Check ksh version (ksh93): ksh --version or echo ${.sh.version} or echo $KSH_VERSION
  • Check ksh version (ksh88):
set -o emacs
ctrl+v
  • Lists all commands in your history file: fc -l
  • Lists all commands in your history file with time execution (export EXTENDED_HISTORY=ON): fc -lt
  • Lists only the commands from 10 to 20 in your history file: fc -l 10 20
  • List the last 10 commands: fc -l -10
  • List all commands starting with command 200: fc -l 200
  • List all commands since alias command: fc -l alias
  • Edits commands using vi editor: fc -e vi 883
  • Repeat the last command: r
  • Repeat the last command starting with the given search text: r topas
  • Repeat the specified command: r 14
  • Find a Korn shell command in the history file: strings -n 1 .sh_history | grep top

Links