Examples of editing previous command lines

To list commands from the history list:

   fc -l 27 34

This lists commands 27 through 34 from the history list. Using the -n option instead of -l prevents the history numbers from being listed.


To edit a command from the history list:

   fc -e emacs 32

This will start the EMACS editor together with the contents of command number 32. You can then edit the command and exit the editor to run the command.


To edit several commands from the history list:

   fc -e vi 27 35

This will start the vi editor and open a temporary file containing commands 27 through 35. You can then edit the commands and exit the editor to run the commands.


[Home] [Search] [Index] This site maintained by webmaster@unixpower.org