Ubuntu's desktop gui is great for changing audio settings (System->Preferences->Sound), like the default input/output device and setting the volume.

However, I would like to be able to do these things from the command-line. What tool is the gui using behind the scenes?


You can control PulseAudio thoroughly through the command line using pacmd and pactl commands. For options see man pages or the wiki at PulseAudio:

pacmd list-sinks (or pactl list short sinks) for name or index number of possible sinks

pacmd set-default-sink "SINKNAME" to set the default output sink

pacmd set-default-source "SOURCENAME" to set the default input

pacmd set-sink-volume index volume

pacmd set-source-volume index volume for volume control (65536 = 100 %, 0 = mute; or a bit more intuitive 0x10000 = 100 %, 0x7500 = 75 %, 0x0 = 0 %)

and many many more CLI options.

Note: Changing the output sink through the command line interface can only take effect if stream target device reading is disabled. This can be done by editing the corresponding line in /etc/pulse/default.pa to:

load-module module-stream-restore restore_device=false

Restart PulseAudio for changes to take effect:

pulseaudio -k

For a more elaborate tutorial on how to do this, and for instructions on how to change the sink during playback see this answer.

  • 3
    Pulseaudio has changed, the first command now should be pacmd list-sinks I think – Anwar Jun 14 '12 at 18:59
  • How would one go about setting an output device to the default input device? I have a Line6 ToneportUX1 (used for moulding guitar tones) that shows up as an output device in Ubuntu's sound control panel, but it should be an input device. – Rob Apr 30 '13 at 1:44
  • @MikeDtrick: this can't be done with these commands. I have no experience with USB devices, but I believe it may be a profile/driver/port/ALSA issue you may have. Is the device recognized as input in ALSA? – Takkat Apr 30 '13 at 6:46
  • I've just started using AlsaMixer, so I'm probably not going to be much help. Under /proc/asound/cards/ it lists the Toneport as a USB device and under /proc/asound/pcm it says playback 1: capture 1. This is all after running alsamixer and clicking [f2]. – Rob May 1 '13 at 19:15
  • 1
    I couldn't switch from headphone to HDMI output this way. Here is how I solved it. – Pablo Bianchi Mar 30 '17 at 23:24

Yes there is type alsamixer in terminal

alt text

Press ,

F1 - Help

F2 - System Information

F6 - Select Sound Card

Esc - Exit the menu

  • 3
    alamixer seems good for changing the volume. How do I change the default device? – paleozogt Nov 19 '10 at 20:53
  • I use it only for adjusting volume levels.Try pressing F6 key and let me know if it helps you. – karthick87 Nov 20 '10 at 7:26
  • 30
    F6 lets you choose a sound card to manipulate, but it doesn't change the default. – paleozogt Nov 20 '10 at 15:48

Not the actual Ubuntu volume control, but better! It lets you control default devices, and even devices per application/stream.

You have to have the app actually be recording/playing for it to appear in the 'Playback' or 'Recording' tabs, but once you choose the device for that app, it seems to remember it forever.

Also, (on a side note), for old (non pulse) applications, run them after padsp, eg:

padsp some_old_app


  • 5
    The question is how to change the audio device from the command line. This is not an application for the command line. – xorinzor Jan 19 '19 at 17:55
  • also, pavucontrol is showing only connected devices, not the paired but disconnected ones. – cipricus Jun 26 '19 at 7:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.