fc -l
fc is a little known but very useful bash built-in.
fc -l will list the most recent 16 commandsfc will open the last command in a text editor defined in the environmental variable FCEDIT or EDITOR or else vi, and re-execute when you exitfc 5 9 will open the history entries 5 to 9 in a text editorfc -s pat=sub will run the last command after substituting pat with sub in it (does not open editor)fc -s pat=sub cc is the same but on the last command starting with ccfc -s cc will run the last command starting with ccFor more info see help fc.