linux通过打开或关闭beep来允许是否让其通过命令行控制发出beep sound。
加载pcspkr模块打开beep
[[email protected] ~]# lsmod |grep pcspkr [[email protected] ~]# echo -en "\a" [[email protected] ~]# echo -en "\a" > /dev/console [[email protected] ~]# modprobe pcspkr [[email protected] ~]# lsmod |grep pcspkr pcspkr 2000 0 [[email protected] ~]# echo -en "\a" [[email protected] ~]# echo -en "\a" > /dev/console
卸载pcspkr模块关闭beep
[[email protected] ~]# rmmod -v pcspkr rmmod pcspkr, wait=no [[email protected] ~]# rmmod -v pcspkr ERROR: Module pcspkr does not exist in /proc/modules
永久禁止加载pcspkr模块
[[email protected] ~]# tail -1 /etc/modprobe.d/blacklist.conf blacklist pcspkr 下面是可选步骤 [[email protected] ~]# tail -1 /etc/rc.d/rc.local /sbin/rmmod pcspkr
试验:
可在加载或卸载pcspkr模块后,进行下面试验,你会得到不一样的效果。(当然,你也可以把数字加大,如把10000变为20000或者是一个你想要的数字)
[[email protected] ~]# for i in {1..10000};do echo -en "\a" >/dev/console;done [[email protected] ~]# for i in {1..10000};do echo -en "\a";done
原文地址:https://www.cnblogs.com/bpsanshao/p/11257295.html
时间: 2024-11-02 03:10:04