Linux Tutorials

Turn Off Terminal Beep Sound on Linux

The terminal beep – also called the bell – is the sound Linux plays when you hit Tab with no completions, backspace at the start of a line, or reach the end of command history. It is distracting in quiet environments and pointless on headphones. This guide covers every method to turn off terminal beep sound on Linux, from a quick session fix to a permanent system-wide solution.

Original content from computingforgeeks.com - post 80

These methods work on all major distributions including Ubuntu, Debian, Fedora, RHEL, Rocky Linux, AlmaLinux, and Arch Linux. The beep originates from the PC speaker kernel module (pcspkr) or the terminal emulator itself, so the right fix depends on where you want to silence it.

Step 1: Disable the Terminal Beep for the Current Session

The fastest way to silence the bell is with the set bell-style readline variable. This takes effect immediately but only lasts until you close the terminal.

Run the following command in your terminal:

bind 'set bell-style none'

This tells the GNU Readline library to suppress the audible bell for the current shell session. The change is lost when you open a new terminal window.

To confirm it worked, press Tab twice on an empty line. You should hear nothing.

Step 2: Disable Beep Permanently with .inputrc

The Readline library reads ~/.inputrc on every new shell startup. Setting the bell style here makes the change permanent for your user account across all programs that use Readline (Bash, Python REPL, MySQL CLI, and more).

Add the setting to your ~/.inputrc file:

echo 'set bell-style none' >> ~/.inputrc

Open a new terminal and test Tab completion on a non-existent command. The bell should be completely silent.

If you prefer a visual flash instead of complete silence, use visible instead of none:

echo 'set bell-style visible' >> ~/.inputrc

The visible option flashes the screen briefly instead of playing a sound, which some users find helpful as a non-intrusive notification.

Step 3: Disable Beep in Bash Shell

If you only use Bash and want the setting tied to your shell configuration rather than the global Readline config, add it to ~/.bashrc.

Append the bind command to your Bash configuration:

echo "bind 'set bell-style none'" >> ~/.bashrc

Reload the configuration to apply it without restarting the terminal:

source ~/.bashrc

Every new Bash session will now start with the bell disabled. This method is Bash-specific and does not affect other shells.

Step 4: Turn Off Beep in Zsh Shell

Zsh uses its own configuration and does not read .inputrc. If you have Zsh installed on your Linux system, disable the beep with the setopt command in ~/.zshrc.

Add the no_beep option to your Zsh configuration:

echo 'setopt no_beep' >> ~/.zshrc

Apply the change immediately:

source ~/.zshrc

You can verify the setting is active by checking the options list:

setopt | grep beep

If the command returns nobeep, the bell is disabled. If there is no output, the option was not applied – check your .zshrc for typos.

Step 5: Disable Terminal Beep System-Wide

To silence the bell for all users on the system, edit /etc/inputrc instead of the per-user file. This requires root access.

Open the system-wide Readline configuration:

sudo vi /etc/inputrc

Add the following line at the end of the file:

set bell-style none

Save and close the file. Every user on the system who does not have a personal ~/.inputrc override will get this setting on their next login. Users who already have ~/.inputrc with a $include /etc/inputrc directive will also pick it up.

Step 6: Blacklist the PC Speaker Kernel Module

The hardware beep comes from the pcspkr kernel module (or snd_pcsp on some systems). Blacklisting it prevents the kernel from loading the module entirely, which silences the beep at the hardware level.

First, check if the module is currently loaded:

lsmod | grep pcspkr

If the module is loaded, you will see output showing pcspkr. Unload it immediately:

sudo rmmod pcspkr

To prevent it from loading on future boots, create a blacklist file:

echo "blacklist pcspkr" | sudo tee /etc/modprobe.d/nobeep.conf

On some distributions, the sound PC speaker module uses a different name. Blacklist it as well to cover all cases:

echo "blacklist snd_pcsp" | sudo tee -a /etc/modprobe.d/nobeep.conf

Verify the blacklist file was created correctly:

cat /etc/modprobe.d/nobeep.conf

The file should contain both blacklist entries:

blacklist pcspkr
blacklist snd_pcsp

After the next reboot, the PC speaker module will not load and the hardware beep will be permanently gone.

Step 7: Disable Beep in Vim

Vim has its own bell that triggers when you press Escape in normal mode, try to move past the end of a file, or make an invalid motion. This is independent of the terminal bell and needs its own fix.

Add the visual bell setting to your Vim configuration:

echo 'set visualbell' >> ~/.vimrc

To also suppress the visual flash (making Vim completely silent), add the t_vb setting:

echo 'set t_vb=' >> ~/.vimrc

The combination of set visualbell and set t_vb= (empty value) tells Vim to use a visual bell but makes the visual bell do nothing – resulting in total silence. If you use Vim on FreeBSD or any other system, the same settings apply.

For Neovim users, the equivalent settings go in ~/.config/nvim/init.vim or use Lua syntax in init.lua:

vim.opt.visualbell = true
vim.opt.errorbells = false

Step 8: Disable Beep in GNOME Terminal and KDE Konsole

Graphical terminal emulators have their own bell settings that work independently of the shell configuration. Even if you disabled the bell in Bash or Zsh, the terminal emulator can still produce a sound or visual flash.

GNOME Terminal

Open GNOME Terminal, then go to Preferences (three-dot menu or Edit menu). Select your profile under Profiles, navigate to the General or Terminal bell tab, and uncheck Terminal bell.

Alternatively, disable it from the command line using dconf. First, find your profile ID:

dconf list /org/gnome/terminal/legacy/profiles:/

The output shows your profile IDs as directory entries. Use the profile ID to disable the bell:

dconf write /org/gnome/terminal/legacy/profiles:/:PROFILE-ID/audible-bell false

Replace PROFILE-ID with the actual UUID from the previous command output.

KDE Konsole

Open Konsole, go to Settings > Edit Current Profile > General. Under the Terminal bell section, set it to None to disable both audible and visual bells.

The Konsole configuration is stored in ~/.local/share/konsole/ in your profile file. You can also edit it directly and set BellMode=0 under the [General] section.

Xfce Terminal and Other Emulators

Most terminal emulators have a similar toggle. In Xfce Terminal, go to Edit > Preferences > Advanced and disable the Audible bell. For xterm, add the following to ~/.Xresources:

xterm*bellIsUrgent: false
xterm*visualBell: false

Apply the xterm changes with:

xrdb -merge ~/.Xresources

Step 9: Disable Beep on Linux TTY Console

If you work directly on a Linux virtual console (TTY, accessed with Ctrl+Alt+F1 through F6), the setterm command controls the bell duration.

Set the bell length to zero to silence it:

setterm -blength 0

This only affects the current TTY session. To make it permanent, add the command to your shell profile (~/.bashrc or ~/.profile):

echo 'setterm -blength 0 2>/dev/null' >> ~/.bashrc

The 2>/dev/null redirect suppresses errors when the command runs inside a graphical terminal emulator where setterm is not applicable. This way the same .bashrc works on both TTY and graphical sessions.

For a system-wide TTY fix, you can also use the xset command on X11 systems:

xset b off

This disables the X11 bell for the current session. Add it to ~/.xinitrc or your desktop autostart to make it persistent.

Quick Reference: Methods to Turn Off Terminal Beep

The table below summarizes all methods covered in this guide for quick reference.

MethodScopeCommand / File
bind ‘set bell-style none’Current Bash sessionRun in terminal
~/.inputrcPer-user, all Readline appsset bell-style none
~/.bashrcPer-user, Bash onlybind ‘set bell-style none’
~/.zshrcPer-user, Zsh onlysetopt no_beep
/etc/inputrcSystem-wide, all usersset bell-style none
Blacklist pcspkrSystem-wide, hardware level/etc/modprobe.d/nobeep.conf
~/.vimrcVim onlyset visualbell / set t_vb=
Terminal emulator settingsPer-emulatorGUI preferences
setterm -blength 0Current TTYRun on virtual console

Conclusion

The terminal beep has multiple sources – the shell, the terminal emulator, Vim, and the kernel’s PC speaker module. For most users, adding set bell-style none to ~/.inputrc and blacklisting the pcspkr kernel module covers all cases. Combine that with the Vim and terminal emulator fixes if you use those tools, and your Linux system will be completely silent when working in the terminal.

Related Articles

Terminal Best Console Terminal File Managers for Linux Terminal Install Fish Shell and Oh My Fish on OpenSUSE / SUSE Terminal Best cd alternative commands for Linux users Git Install and Use lazygit – Terminal UI for Git on Linux and macOS

Leave a Comment

Press ESC to close