I used to have an alias ‘please’ for that.
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.
The manual is a good place to start. It’s just GNU Readline under the hood.

Ctrl A is easier to reach than the home key
Always amused me that
sudo !!is actually more keypresses (at least on keyboards where typing!requires holding Shift).But it’s faster since your hand move less and you can keep
shiftpressedYou 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.
I 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.
Or press Ctrl-S and take a nice walk outside
Is this a shell thing or a terminal thing? It doesn’t work for me on
foot.@Dionysus@leminal.space found out that it’s a feature in
fishshell, which I can confirm.Thanks. I think I should check out
fishsoon, I keep seeing it a lot lately and it seems to be made for lazy people like me. :)
Not sure, I assumed universal because you use it with your history. Type history, see the number next to the command, do a !nnn and it will run that command from history
Oh,
!!definitely works. I meant Alt+S shortcut.Oh, LOL
alias fuck="sudo !!"Wait, you don’t have The Fuck installed?
Cannot find any reference online. What is this supposed to do? Not at a PC right now.
!! Just puts in your last typed command. So if you typed rm -rf /etc, you wouldn’t have permission. But if you typed in sudo !! Right after, then you’re really fucked.
But if you typed in sudo !! Right after, then you’re really fucked.
Not if you don’t type your password.
Adding to this, if you notice numbers next to your previous commands when you run history, you can do !<number> and it will rerun that command. Probably the second cool shell trick I learned back in the olden days or yore (mid-90s?) after ⬆️
I assume if you are silly enough to type in rm -rf /etc, then you are silly enough to type in your password 😅
Ah I wasn’t clear – those, I knew. It’s alt+S I don’t know. I’m at my machine now and it doesn’t seem to do anything on Pop_OS.
Seem to be a
fishshell thing.I tested on my good ole trusty
bashand got nothing so I went searching.EDIT: Clarification :
alt+sseems to be afishshell thing.Ya I haven’t tried alt s. Never heard of it before either.
You can also just do a
sudo !!the!!is a shorthand for whatever you tried to run previously.I learned something new today!
Was about to say, why would you copy anything when using
sudo !!lolNot all shells support that.
I use fish btw.
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 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
I completely forgot about this one!
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.
On my Terminal that just makes it so I can’t type anymore, I feel like I’m doing something wrong…
My solution to the problem is CTRL+U, type sudo, CTRL+Y.
Ctrl + S freezes your shell yes. But Alt + S?
Ah indeed, ALT+S does nothing. I must have pressed both before realizing it was frozen.
If you hit ctrl-s, ctrl-q will unfreeze
Interesting, why is that? Like what feature is that?
Same reason there’s a ScrollLock key on keyboards. Didn’t always have scrollbars and if the application prints more than you can read, you want to pause that…
THAT’S WHAT IT’S FOR??
Now that I think about it, it does seem pretty obvious.
Short answer, terminals are built on the same technology as physical terminals from the 60s and 70s when controlling the flow of data from the server was a more useful feature.
It’s part of the terminal emulator flow control
x👏off👏… x👏on👏… x👏off👏, x👏on👏…flowcontrol.
Need to use the fish shell instead of the others for this to work. (May be a way to enable it in other shells but I’m not sure how)











