6

When I try to clear my terminal screen on OSX:

computer@ ~ () $ ^L

And when I hit Enter after that it just shows:

-bash:
   : command not found

Any ideas on how this happens?

My .bash_profile, .profile, and .bashrc are empty.

3
  • 1
    try to remap : bind -x '"\C-l": clear'
    – Raza
    Jul 7, 2014 at 21:19
  • That worked, however I'm curious of how it came unbound.
    – Adam
    Jul 7, 2014 at 21:29
  • i am not sure.. should check default value I don't know where they defined..
    – Raza
    Jul 7, 2014 at 21:45

2 Answers 2

15

remap control :

bind -x '"\C-l": clear'

2
  • This works in the session, but the problem always comes back in the next session. How can I make this persistent? EDIT: Phillppe's answer below worked. :) Oct 4, 2019 at 17:28
  • sh: 4: bind: not found
    – mathway
    May 1 at 6:18
6

I typically have a ~/.inputrc where I put following bindings

"\C-p":previous-history
"\C-n":next-history
"\C-a.":beginning-of-line
"\C-e.":end-of-line
"\C-l":clear-screen
2
  • 1
    +1 for the .inputrc solution.
    – helix
    Mar 27, 2019 at 5:02
  • Best answer here - it is persistent. Oct 4, 2019 at 17:29

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.