fc stands for either “find command” or “fix command,” since it does both jobs. Use fc -l to list history commands and fc -e to edit them. See the fc entry in the section Built-in Commands in Built-in Commands for more information.
historyList the last 16 commands $
fc -l 20 30List commands 20 through 30 $
fc −l −5List the last five commands $
fc -l catList all commands since the last command beginning with cat $
fc -l 50List all commands since command 50 $
fc -ln 5 > doitSave command 5 to file doit $
fc -e vi 5 20Edit commands 5 through 20 using vi $
fc -e emacsEdit previous command using emacs
Interactive line editing is easier to use than fc, since you can move up and down in the saved command history using your favorite editor commands (as long as your favorite editor is either vi or Emacs!). You can also use the Up and Down arrow keys to traverse the command history and the right and left arrow keys to move around in the command line.