Which bash command will indicate the sound output speaker(output or no output), so I can reset my web radio when it crashes?
-
1It sounds like this question does not want to test that the speakers work, he wants to find out if the OS is currently playing any sound through them. Thus he doesn't want to play sound but to find out if any sound is currently playing. – thomasrutter Dec 13 '15 at 12:14
4 Answers
This is a really good command testing out all speakers.
speaker-test -t wav -c 6
Remarks on usage
There is no loud noise heard when running this command, except a voice saying "front left, front center, front right...". This command will continue to repeat the testing, until the user presses Ctrl+c keys to stop the testing.

- 1,337

- 489
-
3+1 because tested working in Xubuntu 14.04. This works well and there is no loud noise when running this command. – Dec 13 '15 at 08:55
-
2With -l, you can actually specify the loop count if you want it to stop after so many iterations, as in -l2. – abdus_salam Dec 10 '19 at 09:28
-
+1 as this allows to interactively stop playback with Ctrl+Z and it worked on OpenMediaVault 5.5.12-1 out of the box when I connected via SSH for playback on an Odroid Home Cloud 2 single board computer which has USB and an USB digital audio speaker attached. – porg Nov 26 '20 at 21:08
-
2
CTRL+Z
stop and paced the job(speaker-test) in the bg (background). You can list the jobs stopped withjobs
command. Actually you need to kill the job with,CTRL+C
, It take many seconds. – christianbueno.1 May 03 '21 at 01:40
Assuming that all you want is to check if the there is an output on the speaker, Use
speaker-test

- 176
-
yeah and for more info you can use this http://manpages.ubuntu.com/manpages/natty/man1/speaker-test.1.html – Raja G Jun 09 '12 at 03:32
-
OP said
speaker-test
is too noise for him in duplicate question which should be closed soon. Alternatives? – ish Jun 09 '12 at 23:11 -
Without the
-t
option, this outputs a ton of loud static, which you might not like on headphones! – A B Nov 09 '23 at 14:36
To test a two channel (left and right) setup, this plays a voice saying "front left", "front right", then exits:
speaker-test -t wav -c 2 -l 1
For a surround sound setup, set -c
to as many channels as you have:
speaker-test -t wav -c 6 -l 1
Meaning of the options:
-t,--test
wav
play a voice instead of static/noise-l,--nloops
1
test only once-c,--channels
number of output channels to test

- 1,337
If you want it to exit even faster, set both voice output (-t wav
) and one loop (-l 1
):
speaker-test -t wav -l 1
On my setup, it defaults to one channel (-c 1
), so this just speaks "front left" once and then exits.

- 949