Linux command
pactl 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
List all audio sinks
pactl list sinks short
Set the default audio output
pactl set-default-sink [sink_name]
Set volume
pactl set-sink-volume @DEFAULT_SINK@ [50%]
Increase volume
pactl set-sink-volume @DEFAULT_SINK@ +[10%]
Mute/unmute
pactl set-sink-mute @DEFAULT_SINK@ toggle
List all audio sources
pactl list sources short
Move an application
pactl move-sink-input [stream_index] [sink_name]
Load a PulseAudio module
pactl load-module [module-null-sink]
说明
pactl controls a running PulseAudio sound server from the command line. It provides a scriptable interface for managing audio devices, streams, volumes, and modules. Volume can be specified as percentages (50%), decibels (0dB), or absolute values. Prefix with + or - for relative adjustments. Special names @DEFAULT_SINK@, @DEFAULT_SOURCE@, and @DEFAULT_MONITOR@ refer to default devices. The list command shows detailed information about audio objects. Use short for condensed output suitable for scripting. Stream indices from list sink-inputs can be used to move applications between outputs with move-sink-input.
参数
- -s _SERVER_, --server _SERVER_
- Connect to specified PulseAudio server
- -n _NAME_, --client-name _NAME_
- Client name for connection
- -f _FORMAT_, --format _FORMAT_
- Output format (text or json)
- -v, --verbose
- Enable verbose output
- --version
- Show version information
- -h, --help
- Show help message
FAQ
What is the pactl command used for?
pactl controls a running PulseAudio sound server from the command line. It provides a scriptable interface for managing audio devices, streams, volumes, and modules. Volume can be specified as percentages (50%), decibels (0dB), or absolute values. Prefix with + or - for relative adjustments. Special names @DEFAULT_SINK@, @DEFAULT_SOURCE@, and @DEFAULT_MONITOR@ refer to default devices. The list command shows detailed information about audio objects. Use short for condensed output suitable for scripting. Stream indices from list sink-inputs can be used to move applications between outputs with move-sink-input.
How do I run a basic pactl example?
Run `pactl list sinks short` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -s _SERVER_, --server _SERVER_ do in pactl?
Connect to specified PulseAudio server