next up previous contents
Next: aliases Up: Korn Shell Previous: PATH: Search Path   Contents

history

The Korn shell has the ability to remember previously executed commands. It is possible to recall previously issued commands, and edit them before they get executed. Commands can be recalled and edited using two methods:
  1. emacs editor style:
    CTL-P recalls the last command executed. Another CTL-P would recall the command previous to that...
    CTL-N recalls the next command in the history list.
    CTL-F moves the cursor one position to the right.
    CTL-B moves the cursor one position to the left.
    CTL-E moves the cursor to the end of the line.
    CTL-A moves the cursor to the beginning of the line.
    CTL-H erases the character directly to the left of the cursor.
    CTL-D erases the character directly above the cursor.
    ESC ESC (the escape key twice) is a command completion.

    This style of command line editing is enabled with

    set -o emacs
    either in your .profile file, or manually during your logon session.
  2. vi editor style: ESC k will bring the last command on the line, and put you in vi mode (actually, ESC puts you in vi mode, and k recalls the last issued command).

    l moves the cursor one position to the right.
    h moves the cursor one position to the left.
    k recalls the previous command.
    j recalls the next command.
    O moves the cursor to the beginning of the line.
    $ moves the cursor to the end of the line.
    fc finds next character c on the line.
    i puts you in input mode.
    a brings the cursor forward one, then puts you in input mode.
    A brings the cursor to the end of the line, and puts you in input mode.
    ESC takes you out of input mode (or beeps if in vi mode).

    This style of command line editing is enabled with

    set -o vi
    either in your .profile file, or manually during your logon session.

The previous command can be recalled and automatically executed by typing

r
on a command line.
r [string]
will recall and execute the last command used, that began with string.


next up previous contents
Next: aliases Up: Korn Shell Previous: PATH: Search Path   Contents
Claude Cantin 2010-10-24