I'm trying to look for a command that outputs 1 or 0 depending on whether I have my output muted.

I was trying this:

amixer sget Master

This is the output I get:

Simple mixer control 'Master',0
  Capabilities: pvolume pvolume-joined pswitch pswitch-joined
  Playback channels: Mono
  Limits: Playback 0 - 64
  Mono: Playback 64 [100%] [0.00dB] [on]

Now the values change here accordingly (if I decrease volume, the percentage and the dB values change). However, if I head into Pavucontrol and mute my output on the 'Output devices' tab, the output of the command above stays the same. Literally nothing changes. But my sound indeed is muted.

What command should I use? Why doesn't that [on] change to [off]? Shouldn't it?

Thanks in advance.

2 Answers 2


After a long search, I actually managed to find an answer. This might be helpful for others looking for something like this out there!

What you need:

pacmd list-sinks

This command has a line like this:

muted: no

And this no indeed does change to yes, when I mute my device. Perfect. I managed to strip the output using this command, should anyone need it:

pacmd list-sinks | awk '/muted/ { print $2 }'

Sorry for posting too soon, it seemed like I won't be able to find a solution anywhere.

  • 1
    What if you have multiple sinks? Similarly, if you do have multiple sources, the above code need more fine-tuning
    – SHW
    Jan 14, 2021 at 16:15

Alternatively, for those like me who don't have PulseAudio or want to only use amixer, one solution is:

amixer get Master | sed 5q | grep -q '\[on\]'

returning 0 if unmuted and 1 if muted.

  • I used something similar and it doesn't rely on sed, amixer get Master | tail -2 | grep -c '\[on\]'. It returns 2 when muted. Jan 23, 2021 at 2:34

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.