4.5. Command History
4.5.1. Line-Edit Mode
Line-edit mode emulates many features of the vi and emacs editors. The history list is treated like a file. When the editor is invoked, you type editing keystrokes to move to the command line you want to execute. You can also change the line before executing it. When you're ready to issue the command, press the Return key.
Line-edit mode can be started in several ways. For example, these are equivalent:
$ VISUAL=vi $ EDITOR=vi $ set -o vi Overrides value of VISUAL or EDITOR
Note that vi starts in input mode; to type a vi command, press the Escape key first.
184.108.40.206. Common editing keystrokes
4.5.2. The fc and hist Commands
In ksh93, the fc command has been renamed hist, and alias fc=hist is predefined.
$ history List the last 16 commands $ fc -l 20 30 List commands 20 through 30 $ fc -l -5 List the last five commands $ fc -l cat List the last command beginning with cat $ fc -ln 5 > doit Save command 5 to file doit. $ fc -e vi 5 20 Edit commands 5 through 20 using vi $ fc -e emacs Edit previous command using emacs $ r Reexecute previous command $ r cat Reexecute last cat command $ r doc=Doc Substitute, then reexecute last command $ r chap=doc c Reexecute last command that begins with c, but change string chap to doc
Copyright © 2003 O'Reilly & Associates. All rights reserved.