Including Natty I was always able to toggle (mute/unmute) the 'Master' sound volume with the

amixer sset Master toggle

command that I linked to an edge binding in CompizConfig-Manager.

Now after installing Oneiric the command only mutes the sound but doesn't unmute it. I even tried it in the Terminal but it also doesn't work. It changes 'Mono: Playback 68 [78%] [-14.25dB] [off]' to '...[on]' but the sound stays muted so that I have to unmute it via the 'sound-indicator' in the panel.

How can I get this working again? What did change since Natty? Does anyone know the command the 'sound-indicator' uses to toggle the sound volume?

  • And to make it even more strange: on my other laptop, where I upgraded from Natty to Oneiric instead of a fresh install, it still works. – joschi Oct 14 '11 at 6:42

This works for me on 13.04, both mute and unmute:

amixer -D pulse set Master 1+ toggle

It specifies pulse audio to ensure unmute, unmutes everything.

  • Worked on lubuntu 13.10. Been looking for this for WEEKS! – luisgonzalez Dec 10 '13 at 1:31
  • 1
    EDIT: It only worked when running as a command in the terminal. But when i try to configure as a key binding I get: Home directory not accessible: Permission denied ALSA lib pulse.c:243:(pulse_connect) PulseAudio: Unable to connect: Connection refused amixer: Mixer attach pulse error: Connection refused – luisgonzalez Dec 10 '13 at 1:44
  • 5
    It works even better without the 1+ parameter. – J. Katzwinkel Oct 13 '14 at 2:05
  • 3
    Still works in 17.10 (artful). I'm using this for i3 media bindings: bindsym XF86AudioMute exec --no-startup-id amixer -D pulse set Master 1+ toggle – Joel Nov 15 '17 at 20:25
  • 2
    What is the reason for 1+? – Gayan Weerakutti Dec 24 '17 at 10:30

I'm using this script as a workaround:


CURRENT_STATE=`amixer get Master | egrep 'Playback.*?\[o' | egrep -o '\[o.+\]'`

if [[ $CURRENT_STATE == '[on]' ]]; then
    amixer set Master mute
    amixer set Master unmute
    amixer set Front unmute
    amixer set Headphone unmute

I did a diff of amixer scontents before calling amixer set Master mute and after calling it and unmuting everything using the GUI to figure out what needed to be unmuted.

  1. With sound on type amixer scontents > ~/before (you'll get a file with the status of all sound chanels)
  2. Then toggle volume with amixer set Master toggle
  3. Create a second chanel status file with amixer scontents > ~/after
  4. Toggle sound again with amixer set Master toggle which is supposed to turn the volume back to the level before the first toggle command
  5. Create a third file with amixer scontents > ~/afterafter

Now you have three files telling you which tell you the status of the sound chanels used for normal sound, which are muted by amixer set Master toggle and which aren't turned on again by again unmuting with the same command.

To easily compare the files and see the differences (the chanels that get muted and won't unmute afterwards) you can use meld from the Software Centre. Start it, open the three files and on the scrollbar you can see where there are differences between the files. Use the found chanel names to add them to the above described script.

  • Unfortunately the script only mutes sound but doesn't unmute it – joschi Oct 24 '11 at 17:35
  • That's probably because your things that need to be unmuted aren't called "Front" and "Headphone" like they are on my system. – Jim Hunziker Oct 24 '11 at 18:07
  • I also did a diff and found out what was missing for the script to work on my computer, now it works. Thanks a lot. – joschi Oct 24 '11 at 20:11

I couldn't get sound muting to toggle correctly. Whether I used CLI and type in Amixer sset Master toggle or hit the HP pavillion media toggle key, I get the same result: If sound is on and working, it will automatically turn off Master channel AND PCM channel. Then when I hit the toggle again (cli or key) it ALWAYS turns on Master, but leaves PCM muted. For my rig (HP Pavilion DV6 running Xubuntu Oneric), this means sound is off even with master on. When run from CLI - same results. If, with cli, I toggle PCM, it also turns off master channel and again won't turn it back on, though it toggles PCM correctly.

The script that worked was:

    if amixer -c 0 get Master | grep -q off
    amixer set Master unmute
    amixer set PCM unmute

    amixer set Master mute

Then I used Xubuntu keybindings (settings> settings manager> keyboard> application shortcuts) to browse to the script (I called it sndfx.sh and set it to executable by right clicking in thunar and under permissions ticked make executable). Then I assigned the HP Pavilion quickkey to it by tapping that key. Now, it toggles correctly - Awesome. Hope this helps someone else.



If I'm not mistaken, it's a bug that causes other mixer channels to mute and unmute. To mute, try

amixer set Master 0;

To unmute try

amixer set Master 1%+; amixer set Master 7dB+;

  • These commands work, but they don't let me toggle the volume with a single command that I can combine with an edge binding. – joschi Oct 24 '11 at 9:22
  • 1
    If anyone's interested in the associated bug report see here. – joschi Oct 24 '11 at 9:28

Try this script fragment...it works


  • I confirm that this works on my setup, Can you write out the steps to implementing this, in current form it is not much use to other users. – Mateo May 1 '12 at 4:50

If you want to replace amixer in .lircrc for your remotecontrol working with lirc, you can try following lines. Be sure to have xmacro installed. Volume-control now works again.

        prog = irexec
        button = KEY_VOLUMEUP
        repeat = 1
        delay = 2
        config = echo KeyStrPress XF86AudioRaiseVolume KeyStrRelease XF86AudioRaiseVolume | xmacroplay $DISPLAY
        prog = irexec
        button = KEY_VOLUMEDOWN
        repeat = 1
        delay = 2
        config = echo KeyStrPress XF86AudioLowerVolume KeyStrRelease XF86AudioLowerVolume | xmacroplay $DISPLAY
        prog = irexec
        button = KEY_MUTE
        config = echo KeyStrPress XF86AudioMute KeyStrRelease XF86AudioMute | xmacroplay $DISPLAY

The trick is to make the speaker or headphone state follow the state of the master channel depending on if you have the headphones plugged in or not. This script does it for me on my ancient Dell Latitude laptop:


amixer -q sset Master toggle

MASTER_STATE=`amixer get Master | awk -F"dB] " 'NR == 5 {print $2;}'`
HEADPHONES_PLUGGED=`amixer contents | grep -A 2 Headphone\ Jack | awk -F"=" 'NR == 3 {print $2;}'`

if [[ $HEADPHONES_PLUGGED == 'on' ]]; then

if [[ $MASTER_STATE == '[on]' ]]; then
    amixer -q sset $SLAVE unmute
    amixer -q sset $SLAVE mute

You may need to check your channels with amixer on your computer and change the SLAVE definitions accordingly. Also the "Headphone\ Jack" grep string in the HEADPHONES_PLUGGED definition might need to be something else.


Brute force unmute:

for i in $(amixer |grep -o \'.*\'); do amixer set $i unmute; done
  • 2
    I don't think unmuting 80 and more devices is a good idea. This includes microphones, which can lead to unwanted feedback loops. do an for i in $(amixer |grep -o \'.*\'); do echo amixer set $i unmute; done before, to see what would be done. – user unknown Apr 14 '12 at 22:29

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.