There is a nice and alternate way to run a number of commands in sequence from the Bash history:
instead of using history substitute (!432
or !-4
), you can search through the history with Ctrl+r, and once you've found the first command you want to run, hit Ctrl+o (operate-and-get-next) instead of the return key
This will launch the command and propose the next one from the history.
You can hit Ctrl+o as many time as you wish, and end the sequence either with return for a last one, or Ctrl+c to stop without launching it.
↧
Answer by Cyril Chaboisseau for How to execute consecutive commands from history?
↧