14.2 Korn Shell Features
14.2.4 Editing the command line in the Korn shell
The in-line edit mode enables you to edit a previous command on the current command line. Use vi commands to move and edit the previous command line.
Command Format:
set [-+]o vi


Using
set -o vi turns command-line editing on, while set +o vi turns it off. Once the editing has been turned on, pressing the Esc key activates the in-line editor. You then have access to vi commands. In Figure , the use of the more command generates an error since there was a misspelling of "words". Next, the set -o vi command is used to turn vi editing on, and the k key is then used to repeat the previous command so it can be corrected. In this example, the user edited the command to change worfs to words. The k key will move up through the command list and the j key will move down. A way to remember these is k is for kick up and j is for jump down.

The vi commands shown in Figure can be used to edit a command line. The Return key is pressed after all changes are made.

Note - The arrow keys cannot be used to reposition the cursor during in-line editing.

Interactive Media Activity (Flash, 93 kB)
  Command Line Editing with the Korn Shell

In this media activity, you are logged in as user2 and your current working directory is: /home/user2. Type the commands that would accomplish the requested objectives. 
Note: Be sure to press enter after each one. Click on step 1 to begin.