Hacker News new | past | comments | ask | show | jobs | submit
IMO, !$ is most useful of them all (it is the one that gets replaced with the last argument of the last command).

!! you can do just as easily with up-arrow enter, which is just as quick. !ssh you can do with ctrl+r, which actually shows you what it's going to run and whether the last ssh is to where you think it is. sudo !! is up arrow, ctrl+a, 'sudo ', one more keystroke but it's natural if you know your readline. The rest are too complex and not worth learning. !$ is the sweet spot.

instead of !$, I use alt+. for the same reason `up` is preferable to `!!`.

!$:h is new to me. directory name of last argument is nice. I can imagine reaching for that. paired with alt-^ to replace the magic with the actual expanded text before hitting enter

thank you for alerting me to the presence of Alt+.

No idea how I've missed this for as long as I have

`IMO, !$ is most useful of them all (it is the one that gets replaced with the last argument of the last command).`

I've been liking Esc+. for this. It doesn't usually work in browser sessions though, have to do Ctrl+[+. which is a strange feeling 3 finger salute. For some reason I'm able to remember that one rather than !$

Edit: apparently Alt+. does the same, wow.

{"deleted":true,"id":49274238,"parent":49274058,"time":1786549464,"type":"comment"}
>!! you can do just as easily with up-arrow enter

  sudo !!
Ctrl-P-A then typing sudo is just as easy, it's simply up to preference