Sets volume via command line

Categories:  linux
Labels:  terminal, tutorials

This will increase the volume by 2 decibels on the pcm channel. the argument to -c is for which sound card to use, the arg after set is the channel (PCM, Master, etc.) and what to set by. Related commands:

Adjusts the ‘Master’ channel’s volume up by 2dB

Can use command ‘amixer’ to see other channels:

simple mixer control ‘Master’,0

or

simple mixer control ‘Capture’,0

$ amixer -c 0 set PCM 2dB+

Use to volume down

$ amixer -c 0 set PCM 2dB-

Or

$ amixer sset PCM 10%-
$ amixer sset PCM 10%+

This will decrease volume by 2 decibels

$ amixer -c 0 set PCM toggle

To toggle mute/unmute

$ (amixer get Master | grep off > /dev/null && amixer -q set Master unmute) || amixer -q set Master mute

This is for alsa systems

For mac os (and maybe other UNIX systems) osascript -e 'set Volume *' where * is any number (can have decimal points) between 0 and 10

Pulseaudio-ctl: vol+/- and mute from the shell or shortcut keys? :-)

This is much better then the amixer solution (amixer -D pulse sset Master 5%+), it lets me set the volume above 100% and with bad notebook speakers thats priceless

Glad you’re finding it useful. Enjoy! :)

Related Posts:

Social Profiles