That annoying "ding" or "beep" you're hearing is the X11 audible bell. It's often triggered when an application receives a BEL (ASCII 07) character, which is conventionally used for alerts, or when a graphical application tries to signal an error or boundary condition (like trying to delete beyond the start of a line in a text field, or navigating to a non-existent history entry).
Here's how to turn it off, from simplest to most permanent/global:
1. Temporary Fix (Current Session Only): xset
This is the quickest way to disable the bell for your current X session.
Open a terminal and run:
bash
xset b off
xset: Utility for setting various X server parameters.
b: Refers to the bell.
off: Turns the bell off.
To turn it back on (e.g., xset b 100 400 100 for volume, pitch, duration, or xset b on for defaults), you can use different parameters.
Downside: This setting will revert after you log out or restart your X server.
2. Permanent Fix (Per-User, X11 Level): ~/.Xresources or ~/.Xdefaults
You can configure X11 resources to disable the bell for most X applications.
Open your ~/.Xresources file (create it if it doesn't exist) with a text editor:
bash
nano ~/.Xresources
or
bash
gedit ~/.Xresources
Add the following line to the file:
code
Xft*bellStyle: None
(You might also see XTerm*bellStyle: None if it's primarily an xterm issue, but Xft*bellStyle: None is more general.)
Save the file and exit the editor.
Load the new resources: For the changes to take effect immediately without logging out/in, you need to load them:
bash
xrdb -load ~/.Xresources
(If you used ~/.Xdefaults, use xrdb -load ~/.Xdefaults)
Downside: Not all applications respect Xresources directly, though most standard X applications do. This will persist across sessions.
3. Desktop Environment (DE) Specific Settings
Most modern Desktop Environments (GNOME, KDE Plasma, XFCE, MATE, etc.) have their own settings to control system sounds and the X11 bell. This is often the most user-friendly way.
GNOME (e.g., Ubuntu, Fedora with GNOME):
Go to Settings (or System Settings).
Navigate to Sound.
Look for "Alert Sound" or "System Sounds" and choose "None" or uncheck "Enable alert sound."
KDE Plasma:
Go to System Settings.
Navigate to Notifications (or "Application and System Events").
On the "Applications" or "Event Sources" tab, find "System Bell" (or "Bell").
You can often uncheck "Play an audible notification" or select "No sound."
XFCE:
Go to Settings Manager.
Look for Appearance and then the Settings tab. You might find "Enable system bell" there.
Alternatively, check Window Manager Tweaks -> Accessibility tab, there's often a "Enable system bell" option.
MATE / Cinnamon / LXDE / Budgie:
Look for "Sound," "Notifications," or "Accessibility" settings in your system's control panel. The exact path varies but it will usually be related to "System Sounds" or "Alerts."
4. Terminal Emulator Specific Settings
If you mostly experience the bell in your terminal, your terminal emulator might have its own settings.
gnome-terminal / konsole / terminator / kitty / alacritty:
Open the preferences/settings for your specific terminal application. Look for sections like "Profile Preferences," "Bell," "Audible Bell," "Visual Bell," or "Sound." You can usually disable the audible bell and sometimes enable a visual bell (screen flash) instead.
Example (gnome-terminal): Open Preferences -> Profiles -> Select your profile -> Text -> Uncheck "Terminal bell."
5. Global System-Level (Disabling PC Speaker): Blacklisting pcspkr
This is a more drastic measure that disables the physical PC speaker entirely. If your system still uses a legacy PC speaker for beeps (not through your sound card), this will silence it.
Create a blacklist file:
bash
sudo nano /etc/modprobe.d/blacklist-pcspkr.conf
Add the following line to the file:
code
blacklist pcspkr
Save the file and exit.
Update your initial RAM disk (initramfs) to ensure the change takes effect at boot:
bash
sudo update-initramfs -u
(On some distributions like Fedora/Arch, it might be sudo dracut -f or sudo mkinitcpio -P).
Reboot your system for this change to take effect.
Warning: This will prevent any use of the internal PC speaker, including low-level POST beeps from the BIOS on some older machines, although this is rarely an issue on modern hardware. If the sound comes through your regular speakers/headphones, this method won't help.
Recommendation:
Start with Method 1 (xset b off) to confirm it's the X11 bell you're hearing. If that works, then move to Method 2 (~/.Xresources) or Method 3 (Desktop Environment Settings) for a more permanent and user-friendly solution. Method 5 is a last resort if nothing else works or if you want to eliminate the possibility of the old-school PC speaker beep.