Home > Bash Tip & Tricks > How to produce a beep using built-in speaker from the command line interface?

How to produce a beep using built-in speaker from the command line interface?

October 2nd, 2009 Leave a comment Go to comments

On Windows systems (XP or Vista) you can play a beep using the Win32 MessageBeep operating system function.

rundll32 user32.dll,MessageBeep

On Windows platforms you can also use the following command:

echo ^G

You can obtain ^G by pressing together the control key and the "g" key on your keyboard.

On Linux you can obtain the beep at least in two different way:

# echo %'\007'

or

# echo -e "\a"

In Ubuntu you could add a beep command using apt-get command:

# apt-get install beep

# beep

(magic)

But beep adds a lot of feature and not only the simple beep. With beep you can configure a lot of parameters like:

  • Frequency
  • Duration
  • Repetition
  • Delay

for example the following command generate 3 beeps at 300 Hz of frequency

# beep -f 300 -r 3

Gg

  1. No comments yet.
  1. No trackbacks yet.
*

Statistical data collected by Statpress SEOlution (blogcraft).