Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

How can I trace which program is making the computer beep periodically?

Is beeping usually done by writing something to /dev/tty*? How can I monitor which programs are writing to /dev/tty*?

The beep is not at the same frequency as when I do printf '\a' > /dev/tty1.

It vanishes on rmmod pcspkr and reappears on modprobe pcspkr.

share|improve this question

2 Answers 2

up vote 1 down vote accepted

Using this script (try with caution)

function ppid() { cat /proc/"$1"/status | grep PPid: | grep -o "[0-9]*"; };
function pidtree() { P=$1; while [ "$P" != "1" ]; do echo $P; P=`ppid $P`; done; echo 1; };
strace -fe execve `( pgrep ''; pidtree $$ ) | sort | uniq -u | sed 's/^/-p /'`

I found out that ImageMagick's "import" is periodically taking screenshots and causing beeps. Added -silent — now beeps gone.

share|improve this answer

On Linux and most UNIX based OSes, just printing the BELL character (Ctrl+G or '\a') will trigger a beep.

This is implemented through an ioctl() syscall, which is in your shell (bash, etc. support this). The syscall then goes through the kernel and is finally implemented by the pcspkr device, a kernel module. You can see pcspkr loaded with lsmod and unload it with modprobe -r or rmmod.

Don't even think about /dev/tty when thinking about beeps, because even headless programs that aren't bound to a TTY can produce a beep. Run strace -eioctl bash and in the bash prompt run echo ^a. You'll see that producing a beep is a simple but fairly specific ioctl() call (#include <sys/ioctl.h> and <linux/kd.h> if writing a C/C++ program to do this.)


  1. http://tldp.org/LDP/lpg/node83.html
  2. http://www.linuxplayer.org/2010/04/beep-your-pc-speaker-in-linux
share|improve this answer
So, how to reliably find out what program requests a beep? Should I try to strace the whole system? –  Vi. Jul 19 '12 at 15:56
Well you can try running fuser /dev/tty* and fuser /dev/console and go from there, but your signal to noise ratio is going to be fairly heavily favoring "noise" (a lot of activity going on that isn't beeps). Unfortunately you can't easily identify which function calls are being called on a device by which programs using fuser or strace unless you wrap every command in strace... so... you probably need something like dtrace or systemtap or kprobes to see which function calls/ioctls are being made on a given device. –  allquixotic Jul 19 '12 at 16:15
Only "getty"s and "Xorg" seems to be listening to /dev/tty and /dev/console. –  Vi. Jul 19 '12 at 21:27

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.