Using the Korn Shell

You are currently using a web browser that does not support HTML 5. Please try the XHTML 1 or XHTML 1 Mobile version of this page instead.

Setting the Command Line Editor

In the Korn shell, use one of the following commands to set the option to be used for command line editing:

set -o emacs
set -o gmacs
set -o vi

The keys for specific commands will depend on which editor option is specified.

Command Line Editor Keys

Begin command line editing by entering the key sequence to recall a previous command from history. In vi mode, the initial command must be preceded by Esc, so command line editing is initiated with Esc k or Esc -. In emacs or gmacs mode, enter Ctrl-P to recall the previous command or Esc < to recall the first command from the history.

  emacs / gmacs vi
Automatic file name completion Esc Esc Esc \
Begin command line editing Ctrl-P
Esc <
Esc k
Esc -
Previous line/command Ctrl-P k
-
Next line/command Ctrl-N j
+
First line/command in history Esc <  
Last line/command in history Esc >  
Search backward in history   /string
Search forward in history   ?string
Repeat search in same direction   n
Repeat search in reverse direction   N
Execute and advance to next command in history Ctrl-O  
Clear entire line Ctrl-U  
Backwards one character Ctrl-B h
Backspace
Forward one character Ctrl-F l
Backwards to first character of word Esc b b
Forward to first character of word   w
Forward to last character of word   e
Forward to end of word Esc f  
Beginning of line Ctrl-A 0 (zero)
First non-blank character in line   ^
End of line Ctrl-E $
Column n   n| ("or" bar)
Find next character in line   fchar
Repeat find in same direction   ;
Repeat find in reverse direction   ,
Delete character at cursor Ctrl-D x
Delete character before cursor Backspace X
Delete n characters   nx
Delete n characters before cursor   nX
Delete word before cursor Esc Backspace Ctrl-W
Delete from cursor to end of line Ctrl-K D
Delete to end of word Esc d  
Replace current character   r
Replace multiple character   R
Insert before current character   i
Insert after current character   a
Insert at beginning of line   I
Insert at end of line   A
Repeat most recent command   .
Undo last change   u
Undo all changes   U
Cancel emacs command (cancels Esc) Ctrl-G  
Cancel UNIX command; new prompt Ctrl-C  
Display version temporarily Ctrl-V  
Transpose two characters
emacs: transpose current character with following character
gmacs: transpose previous two characters
Ctrl-T  

Last updated Tuesday July 15, 2008


Printer-friendly PDF* format:

Using the Korn Shell

This Section

You are currently viewing this page in HTML 5 Style Sheet* format (* see Clicklets for more infomation). This document is also available in HTML 5 XML*HTML 5 non-XML*XHTML 1 Style Sheet*XHTML 1*XML* HTML 4* XHTML 2* XHTML Mobile* WML Mobile* and printer-friendly PDF* formats. This is accomplished with Single Source Publishing, a content management system that uses templates in XSLT style sheets provided by XML Styles .com to transform the source content for various content delivery channels. There is also RDF* metadata that describes the content of this document.