You can do that??
I always did sudo !!
Why do you not press the up arrow + Pos1?
Fuckit should be able to catch that
Wait… YOU CAN DO THAT?!
Forgot to mention but only in fish shell.
Ah oki lol

- ctrl + p
- ctrl + a
- sudo [space]
- enter
Ayo chill

I approve of the ice to coke ratio. I am now chill.
Start with ctrl+p, ctrl+a but yes
Always amused me that
sudo !!is actually more keypresses (at least on keyboards where typing!requires holding Shift).You just blew my mind.
sudo [space] [shift] !! [enter](4+1+1+1+1+1) is one keypress longer than↑ + home + sudo + space + enter(1+1+4+1+1). In your face, universe.If you have an actual home key. If it’s ctrl+a or (IIRC, AFK) ctrl+← then we’re even.
And if we track hand movements then pressing ! twice may be faster than moving to another key.
But yeah, it’s not at all clear that
sudo !!is faster like you’d expect it to be.
But it’s faster since your hand move less and you can keep
shiftpressedI use zsh with the sudo plugin. Double tap
escand your current or last command will be prefixed with sudo.I don’t dabble in black magic. /j
It’s actually pretty neat.
Ctrl A is easier to reach than the home key
Unless you’re in a default screen session (I always thought ^A was such a dumb default for screen to use).
Screen must have been written by someone who wasn’t familiar with the shell. It’s the only logical explanation.
Maybe someone who only used csh? I can’t remember if ^a is a default in that shell. I thought it started with ksh or bash.
ETA: just looked it up and I’m dumb. Comes from emacs (of course) and looks like it was introduced in bash. I guess I could claim ignorance, being a VI man, but I actually knew at some point that it came from emacs. I think I can count on 1 hand the number of times I’ve used emacs
sudo !!
For some reason I get this

Use zsh
You can also just do a
sudo !!the!!is a shorthand for whatever you tried to run previously.Bruh

What shell are you using? In both bash and zsh,
!!is a substitute for a previous command
Was about to say, why would you copy anything when using
sudo !!lolwish i could alias that
alias ffs=“sudo !!”
alias ffs='sudo $(history -p !!)'Just to confirm: I tried this, it works.
That doesn’t work? I would have thought it would work.
!! Gets replaced by whatever was run before the alias command
Not all shells support that.
I use fish btw.
I made my own !!
I know what you meant (I have one for fish as well), but I chucked because you looked very enthusiastic about it!
The fish function for
!!is super useful though
Holy shit I wish fish supported it. I just press up arrow then hold left arrow and manually type sudo. It fucking sucks
… are you not aware of Alt+S?!
Nope haha. Thanks for letting me know
I’ve been using this plugin https://github.com/oh-my-fish/plugin-bang-bang fish also allows going through previous arguments with alt+up
Epicc. I should install thjs
I’ve used it for so many years that it’s not an issue anymore. I remember using !! a lot but it was literally just for sudo. Now i either write what I need and do up or write what I need and then press alt+s, which seems even more intuitive now.
Does your keyboard not have a home key?
Didn’t know home key could do that lol.
I don’t even know what I use anymore. My distro seems to keep changing it when I reinstall.
echo $SHELLLol, thanks. Now I know.
I learned something new today!
I completely forgot about this one!
I used to have an alias ‘please’ for that.
Lmao
alias fuck="sudo !!"Wait, you don’t have The Fuck installed?
Waiting for it to be rewritten in rust
Only worth installing if it is 🔥🔥🔥blazing⚡⚡⚡fast
<Esc> k I sudo <Space> <Enter>lol no vi mode
Vi mode?
GNU readline is the library that powers features like Ctrl-A, Ctrl-R and Alt+S. By default, it is in emacs mode - that is why it supports these shortcuts, they are the same as in emacs. It also supports vi style editing. You can switch to that by typing
set -o viin your shell. Then you can edit commands as if you were in vi, for example, instead of Ctrl-A you’d do Esc 0. Instead of Ctrl-R you’d do Esc /. If you are fluent in vi then this mode will be more useful.I used to work on really old Unix systems, sometimes over serial connections. They didn’t have bash (only ksh), and they didn’t understand arrow keys. Vi mode was the only way to edit commands that worked reliably.
I know alt +. inserts the last argument of previous commands. There must be a good list of alt commands somewhere because they’re pretty damn useful.
Thanks to you, I just find out new keyboard shortcut
The manual is a good place to start. It’s just GNU Readline under the hood.
Top text should maybe say copying by, rather than copying then? Since sudo !! will automatically copy the previous command with sudo in front of it, so there’s no manual copying involved
Yeah I remembered that after uploading the meme.
Or press Ctrl-S and take a nice walk outside
oh my zsh plugin just let’s you press esc twice :3
Ayo what, I didn’t know that but I use fish.













