Command to mute and unmute a microphone

Go to

System Preferences then Keyboard and click Shortcuts then Custom Shortcuts:

Click on Add

Fill in:

Toggle microphone

and

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).


You can mute the microphone with

amixer set Capture nocap

and unmute the microphone with

amixer set Capture cap

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