Setting the Default Sound Device at the Shell Prompt in Pipewire

Abstract: Resolve audio routing issues by switching the default PipeWire sink or source via the pactl command line without editing configuration files.

Created: 2026-10-17 by

Use the pactl command-line utility to change the default sink or source in PipeWire immediately. Run pactl set-default-sink [name] to switch output devices without editing configuration files, ensuring your changes apply instantly for the current user session.

Identifying Available Audio Devices

Before changing the default device, you must know the exact name of the target sink (output) or source (input). PipeWire manages audio streams similarly to PulseAudio, allowing you to use familiar tools. The most effective way to list all connected and available audio endpoints is using the pactl command with the list sinks or list sources flags. Open your terminal and execute the following command to see a comprehensive list of output devices:
pactl list sinks short
This command returns a concise table containing the index number, the name of the sink, and the driver module. Look for entries that correspond to your hardware, such as "alsa_output.pci-0000_01_00.1.analog-stereo" for built-in speakers or "bluez_sink.00_11_22_33_44_55.a2dp_sink" for Bluetooth headphones. If you need to identify input devices like microphones, replace sinks with sources in the command. Note that the names shown here are unique identifiers used by the PipeWire server. They often include prefixes indicating the backend technology, such as alsa_, bluez_, or loopback_. Copy the full name string exactly as it appears, including underscores and hyphens, because any typo will cause the subsequent setting command to fail. For a more verbose view that includes volume levels and active ports, use pactl list sinks without the short flag, though this produces significantly more output.

Setting the Default Sink via Command Line

Once you have identified the correct name of your desired audio device, you can set it as the default for your current session. This method is immediate and does not require restarting any services or logging out. Use the set-default-sink subcommand followed by the device name you copied earlier. For example, to switch to a specific ALSA output device, run:
pactl set-default-sink alsa_output.pci-0000_01_00.1.analog-stereo
If you prefer to use the numeric index instead of the long name, you can substitute the name with the index number obtained from the previous listing step. However, using the name is generally safer because indices can shift if devices are disconnected and reconnected, whereas names remain consistent for the same hardware instance. After executing the command, verify the change by running pactl info. Look for the line labeled "Default Sink:" near the top of the output. It should now display the name of the device you just selected. You can test the audio by playing a sound file or checking the system volume slider in your desktop environment; it should reflect the new selection immediately.

Configuring Default Sources for Microphones

Changing the default output is only half the equation. Many users also need to switch the default input device, particularly when toggling between built-in laptop microphones and external USB headsets. The process mirrors that of sinks but uses different commands. To list available input devices, use:
pactl list sources short
Then, set your preferred microphone as the default using the set-default-source command:
pactl set-default-source alsa_input.usb-C-Media_Electronics_Inc._USB_Audio_Device-00.analog-mono
Verify the change with pactl info and check the "Default Source:" line. Applications that record audio, such as voice chat clients or recording software, will automatically pick up the newly designated source upon restart or sometimes dynamically depending on how they handle audio routing.

Persisting Settings Across Reboots

The commands described above only affect the current runtime session. If you reboot your computer or log out, PipeWire will revert to its automatic selection logic, which typically chooses the first detected device or the last manually configured one stored in memory. To make these changes permanent, you cannot simply edit a static config file with hardcoded device names, as this approach is fragile and prone to breaking when hardware configurations change. Instead, the recommended approach for persistence involves using PipeWire's client-side configuration or relying on desktop environment settings. However, for shell-based management, many users find it practical to create a small script or alias that applies the pactl commands at login. You can add these lines to your ~/.bashrc or ~/.profile file, ensuring they run after the PipeWire daemon has started. Alternatively, some desktop environments provide graphical interfaces to manage audio profiles. Using these GUI tools often writes the preference to the user's local state directory, which PipeWire respects on startup. If you require strict programmatic control, refer to How to Set the Sound Device's Profile at the Shell Prompt for deeper integration techniques involving profile switching rather than simple sink assignment. Another common issue arises when using USB audio interfaces, where PipeWire may stop working shortly after connection due to permission or module loading errors. Understanding these underlying mechanisms can help troubleshoot why your default setting might not stick. See Pipewire Stops Working Minutes After Using USB Audio Interface on Linux MX-23.4 for detailed troubleshooting steps related to USB audio stability.

Troubleshooting Common Issues

If the default device does not switch correctly, ensure that the PipeWire service is running properly. You can check the status with systemctl --user status pipewire. Additionally, verify that no other application is holding exclusive control over the audio stream, which can prevent the default sink from being utilized correctly. Some applications may ignore the system default and use their own internal audio routing. In such cases, you may need to configure the application specifically or use virtual sinks created by PipeWire-Jack or loopback modules. For advanced loopback configurations involving multiple headphone outputs, consult Configuring ALSA Loopback with Simultaneous Headphone Outputs on Ubuntu 22.04.

Frequently Asked Questions

Why does my default sound device change back after reboot?

The pactl commands only modify the runtime state of the PipeWire server and do not write to persistent configuration files. To maintain a setting across reboots, you must either add the commands to your shell login scripts or use your desktop environment's audio settings panel to save the preference.

Can I use the index number instead of the device name?

Yes, you can use the numeric index provided by pactl list sinks short in place of the device name. However, using the name is safer because indices can change dynamically if devices are unplugged or reordered, whereas names remain stable for the same hardware instance.

How do I check if PipeWire is actually handling my audio?

Run pactl info and look for the "Server Name" field. If it says "PipeWire," then PipeWire is active. If it still references PulseAudio, your system may be falling back to legacy compatibility layers, or PipeWire may not be fully initialized yet.

What should I do if the device name contains special characters?

Always enclose the device name in quotes if it contains spaces or special characters. For example, use pactl set-default-sink "my device name". This prevents the shell from misinterpreting the command arguments and ensures the correct string is passed to the PipeWire server.

Does changing the default sink affect all applications?

Most modern applications respect the system default sink. However, some specialized audio software or games may bypass the system default and connect directly to specific hardware nodes. In those cases, you may need to configure the application individually or use virtual sinks to route audio as needed.

Latest News

How to Display Output of xterm Command in Terminal Screen using Cron

Resolve the inability to display xterm output in a terminal screen from cron by redirecting logs or using wall instead of insecure X11 workarounds.

Read More
Expose Local Server on VPS Preserving Real Client IPs (OS Level)

Resolve VPS logging showing only gateway IPs by configuring reverse proxies to forward real client addresses via X-Forwarded-For headers.

Read More
How to Clear Recent Files History in Linux without Deleting Actual Files?

Clear recent files history in Linux by deleting ~/.local/share/recently-used.xbel without removing the actual files.

Read More
Best HDD Copy Strategy: Manually Syncing and Rewriting Scratch

Resolve data drift between two 4TB hard drives by using rsync with the --delete flag to manually sync and rewrite scratch data for an exact mirror.

Read More
Understanding Bash Prompt Abbreviations: An Overview

Resolve repetitive typing errors by creating and persisting Bash aliases in the .bashrc file for improved command-line efficiency.

Read More
Free Tools and Methods to Log Real-Time Performance Details in Task Manager

Log real-time CPU and memory metrics to CSV files using Windows Performance Monitor Data Collector Sets to troubleshoot system slowness.

Read More
Contact Qatar Airways Customer Service: Phone Number, Help Center, and More

Resolve urgent Qatar Airways reservation issues like flight changes and baggage claims using the US phone number +1801-855-5905 or online self-service tools.

Read More
Windows 11: Alt Codes Displaying Wrong Characters - Solutions

Resolve Windows 11 Alt codes showing wrong characters by verifying the US keyboard layout and enabling Num Lock.

Read More
Run Programs with Elevated Privileges: A Comprehensive Guide

Eliminates the need to type sudo for frequent administrative tasks by configuring .bashrc aliases or functions.

Read More
Dynamically Changing Dates in Excel Formulas Using Cells

Eliminate manual date updates in Excel by using cell references to create dynamic formulas that automatically adjust calculations when input dates change.

Read More
Granting Edit Access to a Specific Excel Sheet in an Office 365 User Email ID-Based Login

Excel Online lacks native sheet-level permissions, so users must split workbooks or use worksheet protection to isolate edit access for specific tabs.

Read More
Creating Network Load on Local Wi-Fi from One PC

Generate sustained Wi-Fi bandwidth load from a single PC using a VM SFTP server to test router stability and throughput.

Read More
Changing the Default Editor for Batch Files in Windows 11's File Explorer

Resolve the issue of batch files opening in Notepad by changing the default editor to a preferred application like VS Code.

Read More
Gain WiFi Connection Minutes Before Losing it by Changing MAC Address

Bypass MAC address filtering to restore WiFi connectivity temporarily when a device is blocked by network administrators.

Read More
Photos Folders Turned Black: Troubleshooting Picture Applications on Windows

Resolve black screens in Windows Photos by resetting the app, updating graphics drivers, and repairing system files.

Read More
Troubleshooting High CPU Temperature Values: A Step-by-Step Guide

Resolve high CPU temperatures and thermal throttling by monitoring with Speedfan, cleaning dust from cooling components, and replacing degraded thermal paste.

Read More
Make cURL establish TLS connection with CA unknown

Resolve cURL TLS connection failures with unknown or self-signed certificates by using the --insecure flag to bypass CA validation.

Read More
Troubleshooting Incorrect Network Metrics Values in Grafana, Prometheus, InfluxDB, and Telegraf

Fix incorrect network metrics in Grafana, Prometheus, InfluxDB, and Telegraf by verifying interface selection, resolving unit mismatches, and handling counter resets.

Read More
Start Another Terminal Window (cmd.exe) Windows Repair/Troubleshoot

Provides step-by-step instructions to access the Windows Command Prompt via bootable media for advanced system repair and troubleshooting.

Read More
Thinkpad P1 Gen 6: Sudden Thunderbolt 3 Dock USB-C Charging Stopped Working

Resolve sudden Thunderbolt 3 dock USB-C charging and internet failure on ThinkPad P1 Gen 6 by updating firmware, resetting the dock, and adjusting power settings.

Read More
ASUS Windows 11 Laptop: Internet Connection Issue with Hotspot

Resolve ASUS Windows 11 laptop spinning wheel issue when connecting to mobile hotspot by resetting network stack, disabling IPv6, and adjusting power settings.

Read More
Developing iOS Project with Firebase: Logging in and Sending Push Notifications

Integrates Firebase to enable secure user authentication and push notifications in iOS applications.

Read More
Troubleshooting Bash Script with Suspected Issues of Spaces, Dashes, Filenames and Quoting

Resolve Bash script failures caused by word splitting, globbing, and special characters in filenames by applying proper quoting techniques.

Read More
Populating OneDrive Folder for Local Backup without Affecting Remote Files

Prevent OneDrive from deleting remote files during Windows reinstallation by unlinking the account or using symbolic links to isolate local data.

Read More
Force First Frame as Keyframe Without Re-encoding: A Quick Solution

Resolve inaccurate seeking and playback glitches by re-encoding video to ensure the first frame is a valid keyframe.

Read More
Find Information in Database Using WSL (Ubuntu) on Windows-10

Resolve database connection issues from WSL Ubuntu on Windows 10 by configuring client tools and network access to query remote or local servers.

Read More
Configuring a New Router with Different Networks: One Family, One Guest

Resolve IP conflicts and isolate guest traffic by configuring a second router with a distinct subnet via its WAN port.

Read More
Quickly Open Multiple Stock Websites with a Single Command

Solve the problem of manually opening multiple stock research websites by creating a single command to launch them simultaneously on Windows, macOS, or Linux.

Read More
Improved Adobe Acrobat Search Experience: Access Advanced Search with Ease

Access advanced search filters like case sensitivity and regex in Adobe Acrobat by clicking More Options in the Find bar.

Read More
Port Forwarding VM via OpenVPN: A Comprehensive Guide

Configure OpenVPN server and iptables to forward specific ports from VPN clients to a virtual machine's internal IP address.

Read More
Understanding Partitions in the 1980s: A Look Back at MS-DOS and Master Boot Record

Explains how the Master Boot Record and partition table enabled MS-DOS to manage multiple disk volumes on a single physical drive.

Read More
Windows 10 Enterprise: Keyboard Not Detected in Managed Organization with Admin Privileges

Resolve Windows 10 Enterprise keyboard detection failures caused by Group Policy restrictions, driver corruption, or USB enumeration errors.

Read More
Can't Find x86_64 Versions of Applications on MacOS arm64 (M1)

Resolve missing x86_64 app issues on M1 Macs by installing Rosetta 2 and reinstalling apps as universal binaries.

Read More
How to Hide Installation Source for an Android App

Manage Android app installation source visibility by using USB transfers or file managers to reduce browser traces and isolate data via work profiles.

Read More
Connecting Momentus 4200.2 ST9808210A Hard Drive via USB Cable

Resolve inability to access Seagate Momentus 4200.2 ST9808210A hard drive by connecting it via USB using a compatible SATA-to-USB adapter and configuring the disk in Windows.

Read More