I'd like to bind Ctrl + L to tput reset rather than clear. Any ideas how to accomplish this?

3 Answers 3


You can use a nice program called AutoKey, which allows you to bind keyboard shortcuts with text actions. To do what you need would be super easy. Take a look at this snapshot, you can copy paste itctrl+l in autokey

  • The keyboard.send_key("<enter>") doesn't seem to work for terminal. The alternative fake_keypress does work, but with too large of a delay.
    – bfletch
    Commented May 18, 2017 at 21:06

This is not for bash, so I will not accept this self posted answer.

I use zsh, and the following at the end of my .zshrc file works well for me:

# Hard clear shortcut
function hard_clear() {
  BUFFER="tput reset"
  zle accept-line 
  zle -U $bak_buff
zle -N hard_clear
bindkey "^[k" hard_clear

We create a function hard_clear() which backs up the buffer, replaces the buffer with tput reset, executes, then rewrites the old buffer. This function is bound to Alt + k.


If you are using zsh you can just use

bindkey "^[k" clear-screen

Works just as well and no need to define a function.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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