How do I make my pc speaker beep
Using bash, how can I make the pc speaker beep?
echo 'beepsound' > /dev/pcspkr would be nice.
Some distros have command-line utilities to achieve this. Maybe you could tell us what distro you are on, or search (e.g.
emerge -s beep in gentoo).
Going beyond “available” utils, you could also make a Perl script that emits the beep, all you need to do is include:
<SomeCodeBefore> print " 07"; <SomeCodeAfter>
If you do end up getting ‘beep’, try out the following:
#! /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
echo -n Ctrl+V Ctrl+G
The downside is that this will work only when the output device is a terminal, so it may not work inside a cron job, for instance. (But if you are root you might be able redirect to
/dev/console for immediate beeping.)