LinuxCommandLibrary

pacmd

Control PulseAudio sound server from the command line

SYNOPSIS

pacmd [options] [command [arguments]]

PARAMETERS

-h
    Show help message and exit.

-p
    Specify the PulseAudio server to connect to. Takes an address as an argument.

-F
    Execute commands from the specified script file. This option can be used multiple times to execute several scripts.

-f
    Fork into the background after connecting to the server and executing any specified script files.

-s
    Start an interactive shell session after connecting to the server and executing any script files.

-n
    Specify the client name to use for this connection to the PulseAudio server.

-v
    Increase verbosity level. This option can be used multiple times for more detailed output.

DESCRIPTION

pacmd is a powerful command-line utility for interacting with the PulseAudio sound server daemon. It provides a flexible interface to query and modify the PulseAudio configuration and state dynamically. While it can be run in an interactive shell mode, allowing users to execute commands one by one, it's also highly scriptable, making it suitable for automated tasks and system configurations.

Users commonly employ pacmd to inspect current audio sinks and sources, adjust volumes, change default audio devices, manage module loading, and control audio routing within the PulseAudio ecosystem. Its comprehensive set of internal commands gives granular control over virtually every aspect of the audio daemon's operation. Although pactl is often preferred for simpler scripting tasks due to its more machine-friendly output, pacmd remains invaluable for complex diagnostics and interactive management of PulseAudio.

CAVEATS

pacmd operates at a relatively low level and requires a running PulseAudio daemon to function. Users new to PulseAudio might find its internal commands complex and less intuitive than higher-level tools. For simpler, one-off scripting tasks or general user interaction, the pactl command is often a more suitable and user-friendly alternative due to its more consistent and parsable output format.

INTERACTIVE MODE AND COMMON COMMANDS

When invoked with the -s option or without any command-line arguments, pacmd enters an interactive shell. In this mode, users can type commands directly to the PulseAudio server, similar to a mini-interpreter. The shell provides tab-completion for commands and arguments, making it easier to discover available functionalities.

Some frequently used internal commands within the pacmd interactive shell include:

list-sinks: Displays detailed information about all available audio output devices (sinks).
list-sources: Displays detailed information about all available audio input devices (sources).
set-sink-volume index/name volume: Sets the volume for a specific audio output device. Volume can be specified as a percentage (e.g., '100%'), a decibel value (e.g., '0dB'), or a raw hexadecimal value (e.g., '0x10000' for 100%).
set-default-sink index/name: Changes the default audio output device that applications will use.
load-module module-name [arguments]: Loads a specific PulseAudio module with optional arguments.
unload-module module-index: Unloads a previously loaded module identified by its numeric index.

HISTORY

pacmd has been a fundamental component of the PulseAudio project since its early development. It was designed as the primary interactive command-line interface for directly managing the PulseAudio sound server, complementing the server's background daemon capabilities. While newer tools like pactl have gained popularity for their scripting friendliness and cleaner output, pacmd continues to be maintained and widely used for its comprehensive interactive control, detailed diagnostics, and the ability to execute complex sequences of commands.

SEE ALSO

pulseaudio(1), pactl(1), pasystray(1), amixer(1)

Copied to clipboard