How to Disable the Terminal Error Bell in Ubuntu 18.04

Audible alerts, particularly the sound emitted from the terminal during certain operations, can sometimes be undesirable. This sound often serves as an error notification or feedback mechanism within the Ubuntu 18.04 environment.

Operations like attempting to backspace past the beginning of a command line or encountering certain tab-completion issues might trigger this alert. This guide outlines several distinct methods to silence this system or terminal-specific sound.

Understanding the Audible Alert

The error sound, frequently referred to as the ‘terminal bell’, is a feature designed to provide immediate auditory feedback. Its behavior can be governed by different layers of the system, including the overall desktop environment’s sound settings, the specific terminal emulator application being used, or even shell configuration settings influencing input behavior.

 

Decision Flowchart

Read: How to display your sound card details on the terminal on Ubuntu 22.04

Methods to Disable the Ubuntu Terminal Sound

Multiple approaches exist to turn off this alert, ranging from graphical interface adjustments to command-line configuration edits. Choose the method that best aligns with your preference and scope (system-wide vs. user-specific, global vs. terminal-only).

Method 1: Adjusting System Sound Settings via GUI

A straightforward way to potentially disable various system alerts, including the terminal bell, involves adjusting the global sound effect settings.

  1. Navigate to system Settings.
  2. Select the Sound category.
  3. Go to the Sound Effects tab.
  4. Locate the Alert Volume slider or switch.
  5. Set the Alert Volume to Off or its minimum level.

This method targets the system-wide alert sound volume managed by the desktop environment.

Methods Comparison

Method 2: Configuring Terminal Emulator Preferences via GUI

If the goal is to disable the sound specifically within the terminal application without affecting other system sounds, the terminal’s preferences can be adjusted.

  1. Open the Terminal application.
  2. Navigate to the menu: Edit > Preferences (or possibly Profile Preferences).
  3. Select the profile you are currently using (usually there’s a default profile).
  4. Look for an option labeled Terminal bell or similar.
  5. Uncheck this option to disable the audible alert for that terminal profile.

This action prevents the terminal emulator itself from triggering the bell sound.

Method 3: Modifying User’s Bash Configuration (`~/.bashrc`)

For users primarily working within the Bash shell, the bell can be disabled by modifying the shell’s runtime configuration file.

  1. Open the ~/.bashrc file located in your home directory using a text editor.
  2. Add the following line to the end of the file:
    bind 'set bell-style none'
  3. Save the file and close the editor.
  4. Open a new terminal window or source the file (source ~/.bashrc) in an existing one for the changes to take effect.

This command instructs the Readline library (used by Bash for input) to use no audible bell.

Read: How to fix Bluetooth connection problems on Ubuntu 22.04

Method 4: Configuring Readline (`inputrc`)

The bell behavior can also be controlled via the Readline configuration file, affecting applications that use this library for input handling.

  1. Choose the scope:
    • For a system-wide change (affecting all users), edit /etc/inputrc (requires root privileges).
    • For a user-specific change, edit or create ~/.inputrc in your home directory.
  2. Add or uncomment (remove a leading ‘#’) the following line in the chosen file:
    set bell-style none
  3. Save the file.
  4. Changes might require restarting relevant applications or logging out and back in.

This method directly configures the Readline library to suppress the bell sound.

Method 5: Using the `dconf` Command-Line Tool

System settings managed by the GNOME desktop environment can often be modified using the dconf command-line utility.

  1. Open a terminal.
  2. Execute the following command:
    dconf write /org/gnome/desktop/sound/event-sounds "false"

This command directly modifies the GNOME configuration database to disable event sounds, which typically includes the alert bell.

Verifying the Change

After applying any of these solutions, you can verify the change by performing an action that previously triggered the sound. Common tests include:

    • Opening a terminal and pressing the Backspace key when the cursor is at the beginning of the prompt.
    • Attempting an invalid tab completion.

If the solution involved editing configuration files like .bashrc or .inputrc, ensure you have started a new terminal session or appropriately reloaded the configuration for the changes to be active. The absence of the audible alert confirms the successful application of the chosen method.

Conclusion

The audible alert or terminal bell in Ubuntu 18.04, while intended as feedback, can be disabled through various means. Whether you prefer a system-wide graphical setting, a terminal-specific preference, or modifying shell/Readline configuration files, effective solutions are available to create a quieter terminal experience.

 

Alex Chen

Alex is a seasoned Linux Systems Administrator and DevOps Engineer with over 12 years of experience architecting and maintaining high-availability infrastructure. He has a deep expertise in kernel tuning, shell scripting, containerization (Docker, Kubernetes), and implementing robust CI/CD pipelines. Alex is passionate about open-source software and finding elegant, automated solutions to complex IT challenges across various distributions.