Take the 2-minute tour ×
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 16 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
@89899.3K Thanks for the info, xdotool looks interesting. –  Dario Sep 20 '11 at 11:14
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

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.