Alter Previous Commands

From Coder Merlin
< Shell
Revision as of 15:15, 25 August 2023 by Jeff-strong (talk | contribs) (Editorial review and minor corrections)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Within these castle walls be forged Mavens of Computer Science ...
— Merlin, The Coder

Sometimes it's helpful to quickly recall a previous command, alter it slightly, and then execute the altered command. Let's try it:

john-williams@codermerlin:~$  mkdir test_execution_17

Now, let's repeat the command, but rather than using 17 again, let's alter the command to use 18:

john-williams@codermerlin:~$  ^17^18^

The command replaces the previous command's 17 with 18 and reruns the command. This is called quick substitution and is an event designator.

For more information, see this post.