Create a Shortcut or Hotkey to Mute the Speakers on Linux

After writing about how to create a shortcut or hotkey to mute the speakers in Windows, I got a couple of requests for how to do the same thing in Linux, which turns out to be really simple if you are running the latest version of Ubuntu or Gnome.

If your version doesn’t have the easy option you can still do the same thing in many versions of Linux with a simple command line.

Setting the Hotkey on Ubuntu

Simply go to System \ Preferences \ Keyboard Shortcuts and then assign a hotkey to the Sound \ Volume mute item.


Once you use the hotkey you’ll see a little dialog pop up to show you what the current volume state is (You can quickly hit the hotkey again to toggle back and forth)


Using the Command Line / Scripts

Alternatively, you can assign a shortcut key to a script that uses the amixer utility to toggle the mute state. To test this out, just open up a terminal window and then use this command:

amixer sset Master toggle

You’ll see the output right there in the console, telling you whether it’s now set to off or on:


And your volume icon should show that the volume has now been muted.


You can create a shortcut to run this command by right-clicking anywhere and using Create Launcher, adding in the full command from above into the Command box.


If you are running Gnome and want to add a shortcut key, you can use this article to assign one. If you are running an older version of KDE, then you’ll want to create a shortcut in the KDE Menu Editor and assign the hotkey there.

Lowell Heddings, better known online as the How-To Geek, spends all his free time bringing you fresh geekery on a daily basis. You can follow him on if you'd like.