How to Completely Disable the System Beep (Bell) in Linux Using the xset Command

If you spend all day working in a Linux terminal, you are intimately familiar with the PC speaker “beep.” This harsh, high-pitched system bell triggers whenever you hit the Backspace key at the beginning of a line, attempt to tab-complete an ambiguous file path, or execute an invalid command.

In the 1980s, when monitors were monochrome and visual feedback was limited, an audible hardware bell was a necessary feature. Today, it is nothing more than an abrasive nuisance that startles you and annoys anyone sitting near your desk in a quiet office environment.

Instead of manually turning down your laptop’s volume or unplugging the physical piezo buzzer from your motherboard, you can completely silence the system bell at the X11 server level using the xset command.

Step 1: Silence the Bell for the Current Session

The fastest way to kill the beep is to instruct the X window system to turn off its audio feedback feature immediately.

  1. Open your terminal.
  2. Type the following command:
    xset -b
  3. Press Enter.

Test it by mashing the Backspace key on an empty command line. The terminal will remain completely silent. However, this is only a temporary fix. The moment you reboot your computer or log out of your user session, the X server will restart and the bell will be fully enabled again.

Step 2: Disable the Bell Permanently

To ensure the system bell is silenced every single time you boot up your computer, you must add the xset command to your user’s X-profile configuration file, so it executes automatically upon login.

  1. In your terminal, open your .xprofile file using a text editor (like nano):
    nano ~/.xprofile
  2. If the file is completely empty, that is fine. Simply paste the following line at the very top:
    xset -b
  3. Save the file and exit (in nano, press Ctrl+O, Enter, then Ctrl+X).

Now, whenever your graphical desktop environment loads, it will read that file and immediately mute the X11 bell.

Alternative: Blacklisting the pcspkr Kernel Module

If you are using a headless server without a graphical interface (meaning xset will not work because X11 isn’t running), or if you want to silence the physical motherboard buzzer at the absolute lowest kernel level so it cannot beep under any circumstances, you must blacklist the driver entirely.

  1. Open the terminal and create a new modprobe configuration file using root privileges:
    sudo nano /etc/modprobe.d/nobeep.conf
  2. Paste the following line into the empty file:
    blacklist pcspkr
  3. Save and exit.

To apply this kernel-level change immediately without rebooting the server, you can forcefully unload the module from the active kernel by running:

sudo rmmod pcspkr

Your Linux machine is now permanently stripped of its ability to generate that high-pitched beep, ensuring complete silence regardless of how many invalid bash commands you type.

RELATED POSTS

  • How to Quickly Create an Empty File in Linux Using the ‘touch’ Command
  • How to Use the patch Command to Apply Code Changes in Linux
  • How to Use the uptime Command to Find Out How Long Your Linux System Has Been Running
  • How to Display Timestamps in Linux Terminal History Using the HISTTIMEFORMAT Variable
  • How to Keep a Linux Terminal Process Running After You Disconnect Using the nohup Command
  • Get the best tech tips delivered straight to your inbox.

    Join thousands of readers mastering Apple, Google, Microsoft, and Linux.