Turn off beep / bell on linux terminal

Working with the terminal using a command line interface is very fast and effective way of doing stuff on Linux systems. But have you tried working with the terminal, listening to some music via headphones and having a terminal warning or tab-completion beep / bell turned ON at the same time? Well, it can be very annoying. Listening to the PC Speaker beeps via headphones is very close to the feeling of hitting your head with a hammer. Even without headphones this beeping bell sound is very annoying.

In this guide, we’ll show you several ways to turn off the terminal beep / bell noise in Linux, without just turning your system volume completely off. These instructions have been tested to work with a variety of major Linux distros.

In this tutorial you will learn:

  • Multiple methods to turn off the bell / beep terminal sound in terminal
  • Turn off beep / bell sound in vim text editor

Disabling the bell terminal sound on Linux

Disabling the bell terminal sound on Linux

Software Requirements and Linux Command Line Conventions
Category Requirements, Conventions or Software Version Used
System Any Linux distro
Software N/A
Other Privileged access to your Linux system as root or via the sudo command.
Conventions # – requires given linux commands to be executed with root privileges either directly as a root user or by use of sudo command
$ – requires given linux commands to be executed as a regular non-privileged user

Turn off bell / beep terminal sound

The simplest way to turn off this noise quickly is by editing the /etc/inputrc file. You can use nano or your preferred text editor to open the file with root permissions.

$ sudo nano /etc/inputrc

In this file, you should see the bell-style directives, which will need to be edited. Specifically, uncomment the following line. You can also use the visible directive but make sure that audible is commented.

set bell-style none
Changing the bell-style directive to disable the command line terminal beeping

Changing the bell-style directive to disable the command line terminal beeping

Once you’ve made that change, you can save your changes to the file and exit. The change should take effect immediately.

While the command line terminal should no longer beep, vi and vim users will still get a beeping sound when using the text editor. To turn it off temporarily, type the following vim command while in vim.

:set visualbell

To turn it off completely, edit or create a .vimrc file in your home directory ( ~/ ) and add the following line:

set visualbell

If none of the above helps simply get rid of the PC Speaker beeps by removing the pcspkr module from your system. This should silence it completely:

# rmmod pcspkr

If you do not want to hear that annoying beep / bell of your PC Speaker again even after system reboot, edit the following file:

$ sudo nano /etc/modprobe.d/blacklist.conf

And add the following line into the list:

blacklist pcspkr

Closing Thoughts

In this guide, we saw how to turn off the bell terminal sound on a Linux system. This can normally be controlled by the /etc/inputrc file and is a quick fix. However, the vim text editor has its own bell setting which must also be edited. Finally, in a unique case where you still hear the bell sound on your system, removing the pcspkr module should definitely do the trick.

Comments and Discussions
Linux Forum