Just how do I make my computer audio speaker beep

Making use of bash, just how can I make the computer audio speaker beep?

Something like echo 'beepsound' > /dev/pcspkr would certainly behave.

2019-05-06 02:45:43
Source Share
Answers: 4


echo -n Ctrl+V Ctrl+G

The disadvantage is that this will certainly function just when the result tool is an incurable, so it might not function inside a cron work, as an example. (But if you are origin you could be able redirect to /dev/console for prompt beeping.)

2019-05-08 11:00:59

I generally make use of the little energy beep mounted on several systems. This command will certainly attempt various strategies to create a system audio.

There are 3 means of developing an audio from the beep manpage :

  1. The typical method of generating a beep in a shell manuscript is to write an ASCII BEL (\007) personality to standard result, using a shell command such as

    echo -ne '\007'

    This just functions if the calling shell's standard result is presently routed to an incurable tool of some type ; otherwise, the beep will certainly generate no audio and also could also create undesirable corruption in whatever documents the result is routed to.

  2. There are various other means to create a beeping sound. A a little extra trusted method is to open /dev/tty and also send your BEL personality there. This is durable versus I/O redirection, yet still falls short in case where the shell manuscript desiring to create a beep does not have a managing terminal, as an example due to the fact that it is ranged from an X window supervisor.

  3. A 3rd strategy is to connect to your X display screen and also send it a bell command. This does not rely on a Unix incurable tool, yet does (certainly) call for an X display screen.

beep will merely attempt these 3 approaches.

2019-05-08 10:39:29

Simply resembling \a or \07 benefit me.

$ echo -e "\a"

This will possibly call for the pcspkr bit component to be filled. I've just examined this on RHEL, so YMMV.


As Warren mentioned in the remarks, this might not function when visited from another location using SSH. A fast workaround would certainly be to reroute the result to any one of the TTY tools (preferably one that is extra). E.g. :

$ echo -en "\a" > /dev/tty5
2019-05-08 10:13:00

Some distros have command - line energies to attain this. Possibly you can inform us what distro you get on, or search (as an example emerge -s beep in gentoo).

Surpassing "readily available" utils, you can additionally make a Perl manuscript that sends out the beep, all you require to do is include :

print "\007";

If you do wind up obtaining 'beep', experiment with the adhering to :

#! /bin/sh 

beep -f 500 -l 700 
beep -f 480 -l 400 
beep -f 470 -l 250 
beep -f 530 -l 300 -D 100 
beep -f 500 -l 300 -D 100 
beep -f 500 -l 300 
beep -f 400 -l 600 
beep -f 300 -l 500 
beep -f 350 -l 700 
beep -f 250 -l 600
2019-05-08 10:09:34