5

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.

Update:

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.

2
  • 1
    Ctrl-l isn't enough? What problem are you facing that causes you to need to run /usr/bin/reset? Nov 23, 2009 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, 2009 at 12:36

2 Answers 2

6

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
5
  • 1
    Thanks! This works, but somehow, after Ctrl-r, the Up Down and tab completion all get screwed up!
    – lprsd
    Nov 23, 2009 at 12:23
  • 3
    Maybe because Ctrl+R is an already registered binding?
    – Marcin
    Nov 23, 2009 at 15:48
  • No, I tried with Ctrl+A as well.
    – lprsd
    Nov 25, 2009 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? Nov 25, 2009 at 14:12
  • Note: .inputrc is applied to anything using readline, if you make some mistake in there you might end up with a messed up terminal (as did Iprsd). Better just to add bind -x '"\C-r"':reset to .bashrc to "restrict" that to bash - Also, I don't think overriding ctrl-r is a good idea :)
    – nnsense
    Jul 19, 2021 at 9:45
1

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

0

You must log in to answer this question.

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