11

In bash on OSX I can do ctrl-_ to undo what I most recently typed. Is there a corresponding redo command?

2
  • 2
    I've done a quick look in readline(3) man page and I can't found nothing about redo command/short-cut. readline(3) is the library responsible by shortcuts and historic feature in bash. If you are interested, you could have a look at the manual here unixhelp.ed.ac.uk/CGI/man-cgi?readline+3. There are all defaults shortcuts listed in this man page. Feb 25, 2013 at 21:08
  • @BrunoCoimbra: looks like there might be nothing, but thanks for the reference.
    – amindfv
    Mar 2, 2013 at 19:30

1 Answer 1

5

ctrl-y is the Readline 'yank' command which retrieves the kill buffer. ctrl-u kills from the point to the beginning of the line (similar to OSX/bash ctrl-_ which clears the whole line). The Emacs-like Readline bindings are enabled in bash and a subset are enabled in many other places (browser search bars etc).

  • ctrl-u kill from start of line to insertion point
  • ctrl-k kill from insertion point to end of line
  • ctrl-w kill previous word (and prepend to kill buffer)
  • ctrl-y yank contents of kill buffer
4
  • 1
    I get different behavior (in Terminal in OS X and XTerm and Emacs in Fedora) - ctrl-_ undoes whatever the last action was, and also ctrl-y retrieves any killed text, not just with ctrl-u. Still, I hadn't heard of ctrl-y before - thanks!
    – amindfv
    Feb 25, 2013 at 22:24
  • Edited my answer to say 'Readline' rather than 'Emacs', although many key bindings are shared, also to broaden the kill buffer's definition. The Readline command kill-whole-line, which does the same as your ctrl-_, is unbound by default - I'd always wondered if there's a kill-whole-line command. I use ctrl-a-k (beginning-of-line kill-line) to kill the whole line.
    – idoimaging
    Feb 25, 2013 at 22:42
  • 7
    For me, ctrl-_ doesn't kill the whole line, though -- it's an undo command
    – amindfv
    Feb 26, 2013 at 0:35
  • 4
    And it doesn't answer the question, either. Jun 22, 2014 at 10:26

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .