就像在cmd里运行 echo [Ctrl + G] 或 echo [alt+7] 一样让主板喇叭发出滴滴滴的声音,即使操作系统静音也能发声.
网上说的 echo -e "\007" 和 printf '\7' 之类发声的是功放喇叭而不是主板报警蜂鸣的喇叭啊,, 系统设置静音的时候就不响了...
大家讲道理2017-04-17 14:47:47
I haven’t used Linux for a long time. I’ll just tell you based on my impression. This is a very complicated issue:
Some motherboards have a switch in the bios that needs to be turned on.
requires kernel support, module name pcspkr
(this condition is generally met, but I prefer to remove this support when using gentoo).
user space support, such as the beep
program (this program is sometimes echo -en 'a'>/dev/console
), root permissions, etc. The switch settings of console and terminal in X are different.
It seems that not all motherboards have independent pc speakers, some are together with the onboard speakers, and need to be unmuted in alsamixer
.
You can google "linux beep", and there are some findings. It seems that ubuntu blacklists the pcspkr module by default.