Embed Notice
HTML Code
Corresponding Notice
- Embed this notice@roobre Bash does have an ability to recall previous commands with !-<num>, where !-1 is the previous command and -2 is the one before that - although that only works on actually executed commands.
In practice it doesn't matter, as you just finish writing the command, let it fail, mkdir <directory>, !-2
Alternately you can press up twice after mkdir.
There is also !*, which selects all previous flags excluding the command.
For example, you have some files you want to view only once;
feh a.png b.png c.png
rm !*