关闭Linux下Shell终端嘟嘟声和vi中错误提醒的Beep音/去掉linux 警告音 嘟嘟声 错误提示音关闭方法

来源:互联网 发布:2017年流行的网络词汇 编辑:程序博客网 时间:2024/05/16 10:32

去掉linux 警告音 嘟嘟声 错误提示音关闭方法

 

 

 

 Ubuntulinux下出错的时候,系统的扬声器会发出难听的声音。

  可以通过下面的命令关掉它。
  rmmod pcspkr

  如果你想重新打开它,可以使用下面的方法。
  modprobe pcspkr

  当然,上面的方法只是临时起效,重新启动后beep依旧,彻底关掉beep的方法如下:

  如果用的是bash作shell,在~/.bashrc的最后添加
  setterm -blength 0
  xset -b

  在 console 下: setterm -blength 0
  在 X-win 的 terminal 下: xset -b

上述方法我试过 很管用

 

 

 


关闭Linux下Shell终端嘟嘟声和vi中错误提醒的Beep音(zz)2009-08-21 13:11
很有用的东西


Q. This beep sound is annoying under Linux, how do I disable it forever?

A. To be frank there are many ways exists - to turn off terminal beep. Use any one of the following method as per your requirements.

If you are using Gnome terminal
a) Open Gnome terminal
b) Click on Settings > Preferences > Silence Terminal Bell

Or Click on General Tab -> General -> Un-Check Terminal bell option

If you are using xterm
Open ~/.xsession file (i.e. /home/you/.xession)
$ cd
$ vi .xession
Append following line
xset b off

Save and close the file.

If you are using bash
Open you ~/.inputrc file (i.e. /home/you/.inputrc file
$ cd
$ vi .inputrc
Append following line:
set bell-style none

Save and close the file.

If you just want to turn off beep for VIM text editor:
Open vim config file ~/.vimrc (i.e. /home/you/.vimrc)
$ cd
$ Vi .vimrc

Append following line
set vb

Save and close the file.

If you are using Ubuntu Linux
a) Click on Applications > Accessories > Terminal
b) Now click on Edit Menu > Current Profile
c) Click on General Tab > General > Remove check box (Terminal bell)

 

 

 

我自己尝试并且成功关闭终端的方法:
在 shell 里面,你可以按下 crtl-g 来测试一下这个嘟嘟声是否已经去掉
在终端(无X11)可以:

setterm -blength 0

#alternatively you can change the frequency of the beep to a very low value:

setterm -bfreq 10

而在 X11 下面(不管是 KDE、Gnome、XFCE 或者……) 你可以:

xset b off

对 Bash:

# has to go into /etc/inputrc or .inputrc
# It will not work in a .bashrc file!

set bell-style none

对 Tcsh:

# put this into your .tcshrc file

# just tab completion beep off:
set matchbeep = never
# any beep off:
set nobeep = 1

我自己尝试并且成功关闭了vi中的beep声的方法:
在~/.vimrc里面添加一行:

set vb

保存退出即可搞定

 

 

原创粉丝点击