replacing last command and execute it
For example
1
$ echo "hello world world world"
2
hello world world world
Copied!
If you want to replace world with universe you can do
1
# If you use ZSH you can press `tab` at the end of the line and it will replace
2
# the whole line with the actuall command
3
$ ^world^universe
4
$ echo "hello universe world world"
Copied!
As you can see, it only replace the first matching word.
If you want it to replace the whole match:
1
# zsh
2
$ ^world^universe^:G
3
4
# bash
5
$^world^universe^&
Copied!
Don't use it in production I tend to use fc command which allow me to edit the command in my editor first
Last modified 1mo ago
Copy link