I'm trying to get CTRL + L to work under solaris 10,

So I tried to add a binding to ~/.inputrc


Well it did bind to the clear command, but clear command itself fails, sigh.

Any ideas?

P.S I've tried to set TERM variable to linux or xterm, which does not help.

enter image description here


Instead of modifying inputrc, looks like I should do

export TERM=xterm

Solaris simply does not work with xterm-256color, which is set by iTerm2 by default.

  • 1
    Does printf '\033\143' clear your screen? – sorontar Dec 19 '16 at 7:17
  • Sorry for the delay. For bash: echo $'"\C-l": "printf \'\\033c\'\015"' >> ~/.inputrc, then ctrl-x ctrl-r to re-read ~/.inputrc, then try ctrl-l. – sorontar Dec 19 '16 at 8:05
  • bash ignores a missing terminal description; clear doesn't. – Thomas Dickey Dec 20 '16 at 0:25

You should try to bind it like this:


That did work at least for me on my CentOS 7 test machine. Unfortunately I could not find any manual reference for this now, but there is this mentioned on bash man page:

       clear-screen (C-l)
          Clear the screen leaving the current line at the top of the screen.  With an argument,  refresh  the
          current line without clearing the screen.
  • Hmm, no effect on solaris. I've logged out and logged in again to confirm that. – daisy Dec 19 '16 at 7:16
  • 3
    Nonetheless, this is the right thing to do and the other answer is just a bodge. Given that the clear command doesn't clear the screen, the problem that you have is some sort of terminfo problem. That is what you need to fix, leaving the readline configuration with the normal binding, as given here. Unfortunately, you haven't shown answerers the important stuff: what terminal type you are using, what terminal emulator program you are using, and a syscall trace (or hex dump of the of the output) of the clear command. Hence answers that don't address terminfo at all. – JdeBP Dec 19 '16 at 8:49
  • @JdeBP so how to fix the terminfo? – daisy Dec 20 '16 at 0:12
  • @JdeBP never mind, setting TERM to xterm fixed the problem, no additional binding required – daisy Dec 20 '16 at 0:14

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.