Sign up ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

I am trying to control the volume using my programming script. How can I do the following in Fedora 15, Ubuntu linux?

  1. Mute/ Unmute
  2. Volume up and volume down

Note: Please note that I use a web USB microphone/speaker and also Analogue microphone/speaker. I want to apply to all to be sure.

share|improve this question

1 Answer 1

up vote 23 down vote accepted

You can use amixer. It's in the alsa-utils package on ubuntu/debian.

Run it without parameters to get an overview about your devices.


Then use the set command to set the volumn. For example to set the master channel to 50%:

amixer set Master 50
share|improve this answer
Thanks! there are two ways to do this 1. As your excellent example: amixer set Master mute; amixer set Master unmute; 2. yum -y install xdotool; xdotool key XF86AudioRaiseVolume; xdotool key XF86AudioLowerVolume; –  YumYumYum Sep 20 '11 at 11:05
And as an addition, you can increase or decrease the volume by amixer set Master 10%+ and amixer set Master 10%- –  user Apr 7 '12 at 21:25
This does not work in Ubuntu. –  Cerin May 24 '12 at 14:37
I disagree @Cerin. This works on Ubuntu LTS 12 right now. Note that the M in master is case sensitive (must be uppercase). –  ashes999 Apr 9 '14 at 16:35
Cerin is right. This does not work. What works is : amixer -D pulse sset Master 50% –  shivams May 7 at 11:22

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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