1

I can use Esc+. to get the last parameter of the previous command, but is there an equally convenient short-cut to get the second to last parameter?

  • 1
    You might be interested in History Expansion. See LESS='+/^HISTORY EXPANSION' man bash. It doesn't quite handle this exact use case in one shortcut for every case, but it has lots of related goodies. – Wildcard Jul 15 '16 at 0:44
3

Yes, M-. is bound to yank-last-arg. M-C-y is bound to yank-nth-arg, where n defaults to one. With a prefix argument of -1 you can, indeed, yank the second last word of the previous line.

  • Thank you, that allowed me to create a binding that did what I wanted. – wonderingnewbie Jul 16 '16 at 18:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.