During voice / video conversations online I would like to mute/unmute the microphone without having to go through all these steps each time:

  • Sound indicator, Sound preferences, Select Input, Mute or unmute the microphone.

I'm looking for either:

  • an application that can do this from the commandline,
  • a way I can assign a keyboard shortcut that can mute/unmute the microphone
  • 1
    If you use Empathy for voice chat, it has a mute button built-in (that works with Google Talk at least, Skype isn't supported yet). – JanC Nov 8 '10 at 14:56
  • I'm looking for something that can be made to run through a shortcut, similar to the main volume mute/unmute laptop toggle button. – Lucian Adrian Grijincu Nov 8 '10 at 16:03

12 Answers 12


Go to

System Preferences then Keyboard and click Shortcuts then Custom Shortcuts:

Click on Add

Fill in:

Toggle microphone


amixer set Capture toggle

For usb webcams you need to chose device (-c 1), or maybe another number.

amixer -c 1 sset Mic toggle

Click Apply and then associate a new key with this command (e.g. the Pause/Break key).

  • Works this with recent releases? Thank you. – Diego V Apr 9 '13 at 19:23
  • 1
    It does work; thanks to Lucian. I have an "Audio mute" key on my laptop, I mapped it to shift+Audio mute, which is very easy to remember :) – Pierre-Antoine Apr 15 '13 at 15:55
  • The command amixer set Mic toggle (not Capture) works for me in terminal but any assigned keyboard shortcut doesn't actually seem to run. I've tried ctrl+Audio Mute but also ctrl+M (captured by keyboard key presses) – Jason Kleban Jan 15 '14 at 15:42
  • Confirmed, this works with Ubuntu 16.10 as well. – Kushal Nov 17 '16 at 7:13
  • On MATE the menus for adding the keybinding are a little different, but it works in the same way. Thanks! – Stephen Angelico Apr 11 '17 at 5:04

You can mute the microphone with

amixer set Capture nocap

and unmute the microphone with

amixer set Capture cap
| improve this answer | |
  • 1
    that worked great with raspberry pi, except you substitute Mic for Capture – WhiskerBiscuit Apr 24 '14 at 6:41
amixer set Capture toggle && amixer get Capture | grep '\[off\]' && notify-send "MIC switched OFF" || notify-send "MIC switched ON"
| improve this answer | |
  • 1
    I like the way in which you combine grep and notifications: Super Neat =) – Musa Al-hassy Jul 18 '17 at 17:19

pacmd is the command line interface to PulseAudio (the sound subsystem used in recent releases). I don't know what the exact command is you'd need but I think you'd want to play with the set-sink-input-mute function.

pacmd is interactive when run without instructions so you have a good opportunity to play around with it and convert that into a one-line function for toggling mute.

| improve this answer | |
  • pacmd is only interactive if you don't give it any commands. I used pacmd list-sources to get a list of inputs and outputs. Under index 2 I had an input devide. (based on its name) Then you can run pacmd set-source-mute 2 1 to mute. Last parameter is a boolean for mute state. 0 or false for unmute and 1 or true for mute. – Vitaly Jan 26 '15 at 17:54
  • Here is a one-liner to toggle, instead of set the state: pacmd list-sources | grep -e 'index' -e 'muted:' | sed -n -e '/index: 5/,$p' | head -n2 | tail -n1 | grep yes && pacmd set-source-mute 5 0 || pacmd set-source-mute 5 1. Note that the index occurs in three places, so you need to change those. – Pieter Bos May 26 at 15:10

the gnome-shell extension nothing to say, which can be installed from its extensions.gnome.org page, provides a microphone icon, mouse and keyboard control, and walkie-talkie style push-to-talk.

| improve this answer | |

Simply mute/unmute with this command:

amixer -D pulse sset Capture toggle

You can also add notification to make sure it's on or off, as per vladimirich answer to the same question

amixer -D pulse sset Capture toggle && amixer get Capture | grep '\[off\]' && notify-send "MIC switched OFF" || notify-send "MIC switched ON"

Inspired by Mark Rooney's comment for muting/unmuting sound.

| improve this answer | |
  • 2
    This actually works for me on Ubuntu 16.04. -q can be skipped. – gronostaj Oct 8 '18 at 9:29
  • 1
    bindsym XF86AudioMicMute exec --no-startup-id amixer -D pulse sset Capture toggle for i3wm – Kristof Tak Nov 7 '18 at 21:20
  • This command works for me in Pop_OS! 19.10 (which is based on Ubuntu 19.10). One can explicitly disable microphone capture with the command amixer --device pulse sset Capture nocap and turn the volume of capturing to 0% simultaneously with the command amixer --device pulse sset Capture nocap 0%. – Patrick Dark Dec 6 '19 at 13:20

To toggle mute of default microphone in pulseaudio:

  1. Make sure that you have pacmd (from pulseaudio-utils package) and notify-send (from libnotify-bin).
  2. Use this script:

pacmd list-sources | awk '\
BEGIN {default_found=0;}

/^[\t ]*\*/ {default_found=1;}

/^[\t ]*name:/ {
    if (default_found) {
        gsub("[<>]", "", name);

/^[\t ]*muted:/ {
    if (default_found) {
        if ($2=="yes") {
        } else {
        system("pacmd set-source-mute " name " " mute);
        system("notify-send --expire-time 1000 --icon " icon " Microphone: " status);

/^[\t ]*index:/{if (default_found) exit;}'
| improve this answer | |

I switch between a USB webcam/mic and my internal mic and the other solutions typically work on the "default" device which is often not the device I'm actively using so I wrote this to mute all microphones

pacmd list-sources | \
        grep -oP 'index: \d+' | \
        awk '{ print $2 }' | \
        xargs -I{} pactl set-source-mute {} toggle
| improve this answer | |
  • I like this atomic approach. Consider using something like 'index: \d?\d' to account for double-digit source indices. – brettinternet Jan 22 at 22:41
  • 'index: \d+' is the more appropriate regexp, but yeah that works :) – blockloop Jan 24 at 17:01
  • Much better, thank you! – brettinternet Jan 24 at 23:37

Complementing the response ofLucian Adrian Grijincu and vladimirich

Add the display of a message by enabling/disabling the microphone.

Run multiple commands on the shortcut command:

$ sh -c "amixer set Capture toggle ; amixer get Capture | \
     grep '\[off\]' && notify-send 'MIC switched OFF' || notify-send 'MIC switched ON'"
| improve this answer | |

You can mute with:

/usr/bin/amixer -q -c 0 sset 'Master',0 mute


/usr/bin/amixer -q -c 0 sset 'Master',0 unmute

You just need to replace 'Master' with the appropriate mixer name, on the terminal use "amixer" to get a list of mixer devices.

About setting the keyboard shortcut check the answers for How can I find which command is bound to a given keyboard shortcut?

| improve this answer | |
  • These mute the sound from my speakers, not the microphone, but thanks. – Lucian Adrian Grijincu Nov 8 '10 at 15:29
  • You just need to replace 'Master' with the appropriate mixer name, on the terminal use "amixer" to get a list of mixer devices. – João Pinto Nov 8 '10 at 15:36
  • This seems to work: # amixer set Capture toggle – Lucian Adrian Grijincu Nov 8 '10 at 15:53
  • Can you edit your response (I don't have the necessary karma) to include this answer so I'll accept it? – Lucian Adrian Grijincu Nov 8 '10 at 16:00

Based on answer above https://askubuntu.com/a/337662/106182

I like to create my own terminal stupid shortcuts. So to configrure m = mute; mm = unmute

I added this to ./.bashrc

# ~/.bashrc
alias m="amixer set Capture nocap"
alias mm="amixer set Capture cap"


interesting enough, yesterday I've re-enable autostart of "Screen Locker (Launch screen locker program) in the menu> sessions and startup > Application Autostart and now my hardware mute button start working (after restart) I have no idea why (XFCE Xubuntu 18.08)

I'm still keeping those terminal shortcuts but just wanted to point out

| improve this answer | |

Using answer of vladimirich I created a script, because we can't execute multiple commands in a hotkey entry.

  • so I made a script with the line:

    amixer set Capture toggle && amixer get Capture | grep '\[off\]' && notify-send "MIC switched OFF" || notify-send "MIC switched ON"
  • put it in a .sh file

  • and call it in the hotkey command with sh <path to script.sh>.

Works like a charm.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.