Set audio volume from the command line

pactl

pactl command is used to control a running PulseAudio sound server.

Increase volume by 10%

pactl -- set-sink-volume 0 +10%

Decrease volume by 10%

pactl -- set-sink-volume 0 -10%

Set volume to 80%

pactl -- set-sink-volume 0 80%

Set volume to 200%

pactl -- set-sink-volume 0 200%

amixer

amixer is a command-line mixer for ALSA soundcard driver.

Increase volume by 10%

amixer set 'Master' 10%+

Decrease volume by 10%

amixer set 'Master' 10%-

Set volume to 10%

amixer set 'Master' 10%

Set volume to 80%

amixer set 'Master' 80%

Shows a complete list of simple mixer controls

amixer scontrols

Keyboard mapping

One can set “Super & +” key to increase volume and “Super & -“ key to decrease volume. The following steps will create shortcut keys to increase and decrease volume by 2%.

  1. Go to Settings Manager
  2. Go to Hardware -> Keyboard
  3. Go to ‘Application Shortcuts’ tab
  4. Click ‘Add’ button
  5. Write the command: amixer set Master 2%-
  6. Type Super and – (minus) key
  7. Again click ‘Add’ button
  8. Write the command: amixer set Master 2%+
  9. Type Super and + (plus) key

Original source: http://blog.chapagain.com.np/ubuntu-linux-increase-decrease-volume-from-command-line-keyboard-shortcut/