16

This question already has an answer here:

I just installed the basic Linux CentOS 7 (no desktop) and am experimenting with the system. Every time I make a mistake (entering things that the command line doesn't like), the computer beeps and it's driving me crazy.

What do I type in the command line to stop this annoying beep?

[root@localhost /]# #what should I run here?

marked as duplicate by slm Aug 29 '14 at 15:51

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

30

This should work:

echo 'set bell-style none' >> ~/.inputrc

Once that's done, open a new terminal and test it.

Source

Edit: changed > (overwrite/create file) to >> (append to file), since it is safer to use.

  • Thank you! It worked. Looking at your command, am I to assume that you have taken the phrase "set bell-style none" and inserted it into a file .inputrc in the $HOME directory? Sorry, I am new to Linux. How do I find $HOME/.inputrc file/director? – user82350 Aug 28 '14 at 22:58
  • @user82350 Great! Well, yes I did. But you can check it for your self in command line via $ cat $HOME/.inputrc or through editor vim $HOME/.inputrc Also, if you found this answer helpful, please use check mark on left hand side (or vote). – Simply_Me Aug 28 '14 at 23:00
  • 3
    @user82350 remember that while this solves your problem with the command line, it won't catch applications beeping on their own (ViM for one can do that and it can get even more annoying than the command line). – peterph Aug 28 '14 at 23:05
  • @peterph thank you identifying the distinction between the answers. My answer deigned to solve OPs issue during command line only as identified in "time I make a mistake (entering things that the command line doesn't like), the computer beeps and it's driving me crazy." – Simply_Me Aug 28 '14 at 23:07
  • If the file doesn't exist, then create it. Ensure you have proper permissions to do this (I ended up having to do this as root for a non-root and non-wheel user). – lobi Dec 28 '15 at 19:55
17

What you're experiencing is often referred to as the "audible bell." There are probably many ways to disable this (often annoying) feature.

Perhaps the simplest is to blacklist the pcspkr module.

  1. Create a new modprobe.d configuration file either blacklisting it (will not load on-boot, but can be loaded at a later time):

    # echo "blacklist pcspkr" > /etc/modules.d/bell.conf
    

    or installing it to a black hole (will never be loaded unless you remove the file or comment out its contents):

    # echo "install pcspkr /dev/null" > /etc/modules.d/bell.conf
    

    I use bell.conf as an example, it can be named whatever you'd like.

  2. Either reboot, or manually run the following to get the behavior functional immediately:

    # rmmod pcspkr
    

Doing the above should pretty well ensure that you never get an audible bell again.

  • Seems a bit harsh no? – Simply_Me Aug 28 '14 at 22:58
  • 7
    Not really; there are plenty of things that I prefer to never load ever (e.g., my webcam driver) unless I very explicitly wish them to do so. I guess it could be seen as overkill, but it solves the issue quite nicely :P – HalosGhost Aug 28 '14 at 23:00
  • 3
    This is the way I have done it for years. – jordanm Aug 29 '14 at 2:01
  • 2
    Even if this exceeds the scope of the OP's question, I myself prefer this way since it eliminates beeps in all applications, not just the shell. – zagrimsan Aug 29 '14 at 2:34
  • This disables the audible bell at large, yes. Personally, I find that ideal. – HalosGhost Aug 29 '14 at 2:35
2

For completeness - if you have alsautils installed, you can usually use alsamixer to set up the sound levels for the PC speaker as well. Remember to run alsactl store once your settings are to your liking to preserve those across reboots (it may be called as part of the shutdown procedure, but doesn't have to).

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