Difference between revisions of "How to disable the pc speaker (beep!)"

From ThinkWiki
Jump to: navigation, search
 
(3 intermediate revisions by 3 users not shown)
Line 1: Line 1:
 
Get rid of the annoying beeps in Linux
 
Get rid of the annoying beeps in Linux
  
== Remove the pc speaker module "pcspkr" ==
+
== Remove the pc speaker modules "pcspkr" and "snd_pcsp" ==
 +
 
 +
You might have only one of these modules in use, but they both enable beeps.
  
 
Open a terminal and issue this command as root:
 
Open a terminal and issue this command as root:
rmmod pcspkr
 
  
To prevent the "pcspkr" module from loading again at startup, open /etc/modprobe.d/blacklist with your favorite text editor (as root) and add following lines to the end of the file:
+
{{cmdroot|modprobe -r pcspkr snd_pcsp}}
# disable the **** pc speaker
+
 
blacklist pcspkr
+
To prevent the "pcspkr" and "snd_pcsp" modules from loading again at startup add them to modprobe's blacklist in {{path|/etc/modprobe.d/blacklist}}.  You can do this with the following command:
 +
 
 +
{{cmdroot|cat <<END >>/etc/modprobe.d/blacklist<br />
 +
blacklist pcspkr<br />
 +
blacklist snd_pcsp<br />
 +
END}}
 +
 
 +
If this does not feel comfortable, you can also edit the aforementioned file with your favorite text editor and add the blacklist lines yourself.
 +
 
 +
 
 +
== New kernels: remove via !<module> ==
 +
In the new linux kernels, the use of file {{path|/etc/modprobe.d/blacklist}} is is deprecated. The correct solution is to put a ! in front ov every module you want to blacklist. For instance, in ArchLinux you just have to modify your {{path|/etc/rc.conf}} according to the following:
 +
 
 +
MODULES=(!pcspkr !snd_pcsp <other modules>)
 +
 
  
 
=== Re-enabling the pc speaker ===
 
=== Re-enabling the pc speaker ===
Temporarily activate it by loading the module (run this from a terminal with root privileges):
+
The speaker can be temporarily activated by loading either of the modules:
modprobe pcspkr
 
  
If you don't want to prevent the module from loading during startup, delete the lines from /etc/modprobe.d/blacklist described in the previous section.
+
{{cmdroot|modprobe pcspkr}}
 +
 
 +
or
 +
 
 +
{{cmdroot|modprobe snd_pcsp}}
 +
 
 +
If you do not want to prevent the modules from loading during startup, delete the two blacklist lines mentioned in the previous section from {{path|/etc/modprobe.d/blacklist}}.
  
 
== Disable console beeps in /etc/inputrc ==
 
== Disable console beeps in /etc/inputrc ==
Line 29: Line 49:
 
Or if it's just the terminal tab auto-completion that's bothering you, uncheck:
 
Or if it's just the terminal tab auto-completion that's bothering you, uncheck:
 
: Terminal > Edit > Current Profile > Terminal bell
 
: Terminal > Edit > Current Profile > Terminal bell
 +
 +
 +
== Dr. Thinkpad; Or: How I Learned to Stop Worrying and Love the Beep ==
 +
 +
Actually, these beeps are quite useful sometimes (especially with shell-scripts that want to get your attention with echo -e "\a" ).
 +
The reason people tend to hate them are because they get overused.
 +
 +
1. Make bash tab-completion less beepy, by editing ''/etc/inputrc'' (or ''~/.inputrc''). Add:
 +
 +
# Show all if ambigious.
 +
set show-all-if-ambiguous on
 +
 +
This makes tab-completion more useful, as well as less irritating: we now only get a beep on a true error (no possible completions); if multiple options are possible, all are printed, and it doesn't beep.
 +
 +
 +
2. Make the beep quieter, shorter, and a nicer pitch. I tend to set 440 Hz, 50ms. Configure with kcontrol (in KDE), or just use xset in your startup files:
 +
xset b 50 440 50

Latest revision as of 20:26, 23 January 2011

Get rid of the annoying beeps in Linux

Remove the pc speaker modules "pcspkr" and "snd_pcsp"

You might have only one of these modules in use, but they both enable beeps.

Open a terminal and issue this command as root:

# modprobe -r pcspkr snd_pcsp

To prevent the "pcspkr" and "snd_pcsp" modules from loading again at startup add them to modprobe's blacklist in /etc/modprobe.d/blacklist. You can do this with the following command:

# cat <<END >>/etc/modprobe.d/blacklist
blacklist pcspkr
blacklist snd_pcsp
END

If this does not feel comfortable, you can also edit the aforementioned file with your favorite text editor and add the blacklist lines yourself.


New kernels: remove via !<module>

In the new linux kernels, the use of file /etc/modprobe.d/blacklist is is deprecated. The correct solution is to put a ! in front ov every module you want to blacklist. For instance, in ArchLinux you just have to modify your /etc/rc.conf according to the following:

MODULES=(!pcspkr !snd_pcsp <other modules>)


Re-enabling the pc speaker

The speaker can be temporarily activated by loading either of the modules:

# modprobe pcspkr

or

# modprobe snd_pcsp

If you do not want to prevent the modules from loading during startup, delete the two blacklist lines mentioned in the previous section from /etc/modprobe.d/blacklist.

Disable console beeps in /etc/inputrc

Another solution is to disable console beeps in /etc/inputrc (change with your favourite editor, should work on all distributions)

# do not bell on tab-completion
set bell-style none

Disable the system beep in Gnome

In Ubuntu 7.10 and later, uncheck:

System > Preferences > Sound > System Beep > Enable System Beep

Or if it's just the terminal tab auto-completion that's bothering you, uncheck:

Terminal > Edit > Current Profile > Terminal bell


Dr. Thinkpad; Or: How I Learned to Stop Worrying and Love the Beep

Actually, these beeps are quite useful sometimes (especially with shell-scripts that want to get your attention with echo -e "\a" ). The reason people tend to hate them are because they get overused.

1. Make bash tab-completion less beepy, by editing /etc/inputrc (or ~/.inputrc). Add:

# Show all if ambigious.
set show-all-if-ambiguous on

This makes tab-completion more useful, as well as less irritating: we now only get a beep on a true error (no possible completions); if multiple options are possible, all are printed, and it doesn't beep.


2. Make the beep quieter, shorter, and a nicer pitch. I tend to set 440 Hz, 50ms. Configure with kcontrol (in KDE), or just use xset in your startup files:

xset b 50 440 50