Linux – Disable Beeping in the Terminal

Are you tired of hearing that annoying beep sound when using your terminal on Linux? Even if you’ve turned off the speaker, this irritating noise persists. Don’t worry; I’m here to guide you through the simple process of disabling it.

Open a terminal window and run the following commands:

sudo apt-get update
sudo apt-get install -y pcspkr-utils
sudo apt-get remove -y pcspkr
echo "blacklist pcspkr" >> /etc/modprobe.d/blacklist

Explanation:

  1. sudo apt-get update: Update the package list to ensure you’re using the latest version of the system.
  2. sudo apt-get install -y pcspkr-utils: Install the pcspkr utilities, which are required for disabling the beep sound.
  3. sudo apt-get remove -y pcspkr: Remove the pcspkr package, which is no longer needed.
  4. echo "blacklist pcspkr" >> /etc/modprobe.d/blacklist: Add a line to blacklist the pcspkr module in the /etc/modprobe.d/blacklist file.

After executing these commands, restart your terminal or run source ~/.bashrc (for Bash) or source ~/.zshrc (for ZSH) to apply the changes. The beep sound should now be disabled.

To enable the terminal beep just edit the  /etc/modprobe.d/blacklist and delete the line that have:

blacklist pcspkr

This will restore the pcspkr module and reinstate the beep sound.