PulseAudio is better, but not so simple: pactl set-sink-mute 0 1 Do the work for the first device, but not if you are using headphones of another sink output.
The better way is to check with pactl info and get the Default Sink to use.
I wrote a script to manage pulseaudio in my note. If you want to use, save it as volume, provide execute permissions chmod +x volume and add it to your path ln -sv $PWD/volume /usr/local/bin/. Here my script:
Assuming you're using ALSA driver, run:
Or, you can just use:
to toggle mute on and off.
This worked for me when others didn't:
This is from the link in nutty about natty's comment to the first answer:
I'm using
pactl
in my scripts. From man page:To mute:
To unmute:
To toggle:
Use
0
instead of@DEFAULT_SINK@
to set the sink with numerical index 0. true=="1", false=="0".Tested on Ubuntu 12.10.
In my setup sometimes amixer unmute fails for some reason.
On the terminal type this to mute
type
Tested on my Ubuntu 10.10.
If you are using
alsa
follow goric answer.PulseAudio is better, but not so simple:
pactl set-sink-mute 0 1
Do the work for the first device, but not if you are using headphones of another sink output.The better way is to check with
pactl info
and get theDefault Sink
to use.Then to mute:
Or unmute:
I wrote a script to manage pulseaudio in my note. If you want to use, save it as
volume
, provide execute permissionschmod +x volume
and add it to your pathln -sv $PWD/volume /usr/local/bin/
. Here my script:if your are using pulseaudio as the sound server then do this
to mute and unmute
if using alsa then use this
to mute and unmute