Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

How to emit sound using built-in speaker from a command line in Windows and Linux?

share|improve this question
What operating system? – arathorn Jul 24 '09 at 16:08
up vote 8 down vote accepted

You can call the Win32 MessageBeep operating system function.

On Windows XP or later, type:

rundll32 user32.dll,MessageBeep

I tried it years ago and at first I didn't believe it would work. But that's Microsoft suggested way, as according to their MSDN website:

"...MessageBeep attempts to play the system default sound. If it cannot play the system default sound, the function produces a standard beep sound through the computer speaker."

share|improve this answer

With bash on Unix:

echo $'\007'
share|improve this answer
Echo ^g

where ^ is the ctrl key. Note this doesn't work on Windows 7 - The beep is redirected to the audio system.

share|improve this answer
hey, it works on Windows 7!!!! I think for some motherboards that does not have internal speaker or that it is disabled on sound properties it will not beep. but I tested and functioned!!! but use CTRL instead of "^" character. I don't know the difference, but... – kokbira May 10 '11 at 20:08

On *nix operating systems beep used to do it.


beep [ -v ] [ -X | -T | -S ]


beep is a command-line utility for making a computer go beep.

Under normal circumstances, you should be able to use it just by typing ‘beep’, with no options.

share|improve this answer
What operating systems were these? – Richard Hoskins Jul 24 '09 at 16:58
You can install this from most debian based linux repositories with sudo apt-get install beep – Charles Ma Jul 25 '09 at 5:04
required modprobe pcspkr too, – Aquarius Power Nov 23 '15 at 18:44

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.