Set volume from terminal

  • Is it possible to set the audio volume using the terminal instead of clicking the speaker icon in the top bar?

    The reason I want to do this is that my keyboard does not have volume increase/decrease buttons and I find it annoying to reach for the mouse.

    Read Master Volume level in number percent 0%-100%: `amixer sget Master | grep 'Right:' | awk -F'[][]' '{ print $2 }'` Increase Master volume level by 10%: `amixer -q sset Master 10%+`

  • Renan

    Renan Correct answer

    9 years ago

    For interactive usage you can use alsamixer. For scripting (e.g. binding to key combinations) take a look at amixer.

    alsamixer is included by default in most systems.


    To set the master volume use:

    # Gets a list of simple mixer controls
    $ amixer scontrols 
    

    Then set it to the desired volume, as an example

    $ amixer sset 'Master' 50%
    

    What is the different between "sset" and just "set". (I tried both, and both work)

    @Venryx `man amixer` suggests that the they are equivalent and that the "s" in "sset" stands for "simple". There's also a "cset" that sets card control contents.

    Added the following to my `.bashrc` to make this command easier: `volume() { amixer sset 'Master' $1%; }`

License under CC-BY-SA with attribution


Content dated before 6/26/2020 9:53 AM