This article applies to CentOS 6.3, but should also work with other versions of Linux in some form. There may be circumstances where disabling the system bell in Gnome is very advantageous. The bell is not only in Gnome terminal, but throughout the UI wherever text is entered, and has the tendancy to momentarily freeze the system when activated. Unfortunately, while working in a virtualized environment, turning off this “feature” is more complicated than it appears. The article http://www.cyberciti.biz/faq/how-to-linux-disable-or-turn-off-beep-sound-for-terminal/ describes two methods to disable the bell. If they do not work for you (as they did not work for me) then read on.
Using the command string, “xset b off” from a terminal will ultimately turn off the system bell. However, this has to be run as a user after the X session has loaded. I spent hours trying out various methods of spawning this command, and ultimately figured out that the timing of when xset executes is absolutely critical. Using a 30 second delay seems to work on my system. For a slower machines, try a longer wait time. Even though my system appears to be running nearly instantaneously, 10 and 15 second delays were apparently too short. I hope this helps someone else who has this problem, but in my opinion it’s a huge oversight that Gnome doesn’t have a disable system bells function built directly into the UI.
Here are the required steps in order to permanently disable the system bell in Gnome and Centos 6.3 while running as a virtual machine.
Ensure that the directory /home/user/.config/autostart exists, and create it if it does not using the mkdir command.
Note: The path must be modified to fit your username and home directory location.
In that directory, create a file, e.g. nobells.desktop
Paste these contents using your favorite editor, taking care to modify the username and path as appropriate:
GenericName=Disable System Bells
Comment=Gets rid of annoying bells
Now create a file in your home directory, where /home/user was used as an example. The previous sample called it .nobells.sh in this case. Note that this file is “hidden” because of the proceeding dot in front of the file name.
Paste this contents into .nobells.sh:
/usr/bin/xset b off
Change permissions of .nobells.sh to 755 using chmod 775 <file>
At your next login, the system bell should be disabled.