echo command might failed because the bell might be disabled via
~/.inputrc like something with either one of these :
set bell-style none
set bell-style visible
Or it could also be your terminal that have bell sound disabled.
You also need to check that there is no
setterm -blength 0
in any of you profile shell script like
/etc/profile.d/*.sh or in your
So you better try the
beep command that really use the on-board-speaker and not echo command that goes through different layer (where it could be blocked) to finally get the beep sound.
Note, however that you might need to run beep with root privilege for it to work. aka
Are you sure, you have an on-board pc-speaker ? We don't talk about the built-in speaker of your laptop. We talk about some small speaker found on motherboard (of tower pc for exmaple), that's used to signal boot error with beep sound. This does not exit a lot anymore, in laptop for example.
You can check if you have a true PC Speaker by looking at output of
amixer, if you have alsa installed, and look for something like 'PC Speaker'
Your alternative is to use
aplay and play a sound
cat /dev/urandom > /dev/snd/pcmC0D0c should work but it use your sound card, not the built-in-on-board-pc-speaker.