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.

Profile Photo for Lowell Heddings Lowell Heddings
Lowell is the founder and CEO of How-To Geek. He’s been running the show since creating the site back in 2006. Over the last decade, Lowell has personally written more than 1000 articles which have been viewed by over 250 million people. Prior to starting How-To Geek, Lowell spent 15 years working in IT doing consulting, cybersecurity, database management, and programming work.
Read Full Bio »