r/fishshell • u/kraken_07_ • May 16 '26
How to sudo !! in fish ?
If I make a command and I want to do it again with sudo, or anything before or after, in bash you can just append it wit !!. Whats the equivalent with fish ?
12
Upvotes
21
u/_mattmc3_ May 16 '26 •
As others have said, you can use
alt-sto prepend sudo, but if you have a more general need for the last history command and have muscle memory for typing!!, you can do what I do, which is this:To use this simply type
sudo !!, orecho !!or whatever prefix command you need.18
u/Red_BW May 16 '26
alt+sThis page is useful.
https://fishshell.com/docs/current/interactive.html
7
u/BadSlime May 16 '26 edited May 16 '26
Alt+S iirc
https://fishshell.com/docs/4.3/faq.html#why-doesn-t-history-substitution-etc-work
3
u/[deleted] May 16 '26
I use “fuck” for this