Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
up vote 68 down vote accepted

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 to list 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 (0 = Mute, 65536 = 100%)

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 corresponing line in /etc/pulse/ to:

load-module module-stream-restore restore_device=false

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

share|improve this answer
Pulseaudio has changed, the first command now should be pacmd list-sinks I think – Anwar Shah 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
If your pacmd list-sinks lists only one sink but you can see several output devices in System Settings > Sound, check this answer:… – Severo Raz Jul 20 '14 at 21:59

Yes there is type alsamixer in terminal

alt text

Press ,

F1 - Help

F2 - System Information

F6 - Select Sound Card

Esc - Exit the menu

share|improve this answer
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
F6 lets you choose a sound card to manipulate, but it doesn't change the default. – paleozogt Nov 20 '10 at 15:48

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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