amixer

audiolinux
The amixer command is one of the most frequently used commands in Linux/Unix-like operating systems. amixer The amixer command is a command-line mixer for ALSA (Advanced Linux Sound Architecture) sound card drivers, allowing users to control audio settings and volume from the terminal.

Quick Reference

Command Name:

amixer

Category:

audio

Platform:

linux

Basic Usage:

amixer [options] [arguments]

Common Use Cases

    Syntax

    amixer [options] [command]

    Options

    Option Description
    -h, --help Display help and exit
    -c, --card CARD Select the sound card by number
    -D, --device DEVICE Select the device name (default: default)
    -d, --debug Debug mode
    -n, --nocheck Do not perform range checking
    -v, --version Print version number
    -q, --quiet Be quiet (no messages)
    -R, --raw-volume Use the raw value (not percentage)
    -M, --mapped-volume Use the mapped volume (percentage)

    Examples

    How to Use These Examples

    The examples below show common ways to use the amixer command. Try them in your terminal to see the results. You can copy any example by clicking on the code block.

    #

    Basic Examples:

    # Display information about all controls for the default sound card
    amixer
    # Get information about a specific control amixer get Master
    # Set the Master volume to 80% amixer set Master 80%
    # Increase Master volume by 5% amixer set Master 5%+
    # Decrease Master volume by 10% amixer set Master 10%-
    # Toggle mute for the Master control amixer set Master toggle

    Advanced Examples:

    # Set the Master volume to 75% for a specific sound card
    amixer -c 1 set Master 75%
    
    # Set PCM volume to 80% and unmute it in one command
    amixer set PCM 80% unmute
    
    # Set the left and right channel volumes separately
    amixer set Master 70%,60%
    
    # Set the capture (microphone) volume to 75%
    amixer set Capture 75%
    
    # Toggle the microphone capture
    amixer set Capture toggle
    
    # Get all playback controls
    amixer scontrols
    
    # Get all values for all simple controls
    amixer scontents
    
    # Use a specific device by name
    amixer -D hw:0 set Master 80%
    
    # Show detailed information
    amixer -D hw:0 info
    

    Try It Yourself

    Practice makes perfect! The best way to learn is by trying these examples on your own system with real files.

    Understanding Syntax

    Pay attention to the syntax coloring: commands, options, and file paths are highlighted differently.

    Notes

    Common Commands:

    The amixer utility accepts the following commands:

    • get CONTROL: Display settings for the specified CONTROL
    • set CONTROL VALUE: Adjust the value of the specified CONTROL
    • scontrols: Show all simple mixer controls
    • scontents: Show contents of all simple mixer controls
    • controls: Show all controls for the mixer
    • contents: Show contents of all controls for the mixer
    • info: Show info about the mixer

    Adjusting Controls:

    When using the set command, you can specify values in several ways:

    • set Master 80%: Set volume to 80%
    • set Master 3dB: Set volume to +3dB (if supported by hardware)
    • set Master 10%-: Decrease volume by 10%
    • set Master 5%+: Increase volume by 5%
    • set Master 1+: Increase volume by 1 step
    • set Master 2-: Decrease volume by 2 steps
    • set Master mute: Mute the control
    • set Master unmute: Unmute the control
    • set Master toggle: Toggle between mute and unmute

    Channel Control:

    You can adjust individual channels using comma-separated values:

    • set Master 80%,70%: Set left channel to 80% and right channel to 70%
    • set Capture 90%,80%,85%: Set three channels to different values
    • set Mic cap: Enable capture for the microphone (for recording)
    • set Mic nocap: Disable capture for the microphone

    Finding Available Controls:

    Before adjusting audio settings, you may need to know what controls are available:

    # List all simple controls
    amixer scontrols
    
    # List all controls with current values
    amixer scontents
    
    # List controls for a specific card
    amixer -c 1 scontrols
    

    Common Controls:

    Most sound cards have these common controls:

    • Master: Overall output volume
    • PCM: Digital volume control for playback
    • Headphone: Volume for headphone output
    • Speaker: Volume for built-in speakers
    • Capture: Main recording input level
    • Mic: Microphone input level
    • Line: Line input level
    • Auto-Mute Mode: Automatic muting of speakers when headphones are connected

    Scripting with amixer:

    Amixer is often used in scripts for audio control. Some examples:

    # Check if Master is muted
    if amixer get Master | grep -q '[off]'; then
      echo "Sound is muted"
    fi
    
    # Get current volume percentage
    volume=$(amixer get Master | grep -o '[0-9]*%' | head -1)
    echo "Current volume: $volume"
    
    # Create a simple volume increase script
    #!/bin/bash
    amixer -q set Master 5%+
    

    Sound Card Selection:

    If you have multiple sound cards:

    • Use -c CARD or --card CARD to select a specific card by number
    • Use -D DEVICE or --device DEVICE to select a device by name
    • List available cards with aplay -l or cat /proc/asound/cards

    Saving Settings:

    Like alsamixer, amixer doesn't save settings between reboots. To save settings:

    # After making changes with amixer, save them
    sudo alsactl store
    

    Important Notes:

    • Amixer requires the alsa-utils package to be installed
    • On systems using PulseAudio or PipeWire, changes made with amixer may be overridden
    • For PulseAudio systems, consider using pactl or pacmd commands instead
    • Amixer provides a more script-friendly interface compared to alsamixer
    • The available controls vary significantly between different sound cards
    • Some controls may have non-obvious names specific to your hardware

    Related Commands

    These commands are frequently used alongside amixer or serve similar purposes:

    Use Cases

    Learn By Doing

    The best way to learn Linux commands is by practicing. Try out these examples in your terminal to build muscle memory and understand how the amixer command works in different scenarios.

    $ amixer
    View All Commands