Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

share|improve this question
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 There are all defaults shortcuts listed in this man page. – Bruno Coimbra Feb 25 '13 at 21:08
@BrunoCoimbra: looks like there might be nothing, but thanks for the reference. – amindfv Mar 2 '13 at 19:30

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
share|improve this answer
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 '13 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. – Andrew Crabb Feb 25 '13 at 22:42
For me, ctrl-_ doesn't kill the whole line, though -- it's an undo command – amindfv Feb 26 '13 at 0:35
And it doesn't answer the question, either. – suzanshakya Jun 22 '14 at 10:26

You must log in to answer this question.

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