I seem to be entering reset command on bash way too often.

I want to configure it to a keyboard shortcut.

Say Ctrl+r or something like that.

How to do it.


To answer the question, why I want to do this, and not just clear,

  1. So many times, I want to see git (or svn or hg) diffs and starting over from top is convenient, without bothering where was the command.

  2. So many times, the characters on the bash gets eaten up (and not displayed), when used as a server and some python stuff is done (And I know this is bash's problem because, zsh and fish dont have the problem). Only way to get it working back is reset.

  • 1
    Ctrl-l isn't enough? What problem are you facing that causes you to need to run /usr/bin/reset? – Suppressingfire Nov 23 '09 at 11:35
  • 2
    I've never had to use 'reset' so much so, I had to look up what it actually does. Are you 'cat'-ing binary files or something? – JRT Nov 23 '09 at 12:36

You can modify your /etc/inputrc or ~/.inputrc file according to this syntax.

Bash also has a bind command that allows you to modify keybindings.

I think they share a similar syntax for running shell commands. Example:

$ bind -x '"\C-r"':reset
  • 1
    Thanks! This works, but somehow, after Ctrl-r, the Up Down and tab completion all get screwed up! – Lakshman Prasad Nov 23 '09 at 12:23
  • 3
    Maybe because Ctrl+R is an already registered binding? – Marcin Nov 23 '09 at 15:48
  • No, I tried with Ctrl+A as well. – Lakshman Prasad Nov 25 '09 at 12:50
  • Are you saying that when /usr/bin/reset when invoked via Ctrl+A, it operates differently than when you run it by typing its name? – Suppressingfire Nov 25 '09 at 14:12

I know Ctrl+L is the same as running clear command. If this is enough for you, then it's already implemented :)

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.