怎样设置消除vi、less、等程式的喇叭响声

Here is a feasible way I have tested(just feasible, but not easy )

open the file: /usr/src/linux-2.4/drivers/char/vt.c and, locate the following code:

#if defined(__i386__) || defined(__alpha__) || defined(CONFIG_PPC_ISATIMER) \
    || (defined(__mips__) && defined(CONFIG_ISA)) \
    || (defined(__arm__) && defined(CONFIG_HOST_FOOTBRIDGE)) \
    || defined(__x86_64__)

static void
kd_nosound(unsigned long ignored)
{
        /* disable counter 2 */
        outb(inb_p(0x61)&0xFC, 0x61);
        return;
}

void
_kd_mksound(unsigned int hz, unsigned int ticks)
{
        static struct timer_list sound_timer = { function: kd_nosound };
        unsigned int count = 0;
        unsigned long flags;

        if (hz > 20 && hz < 32767)
                count = 1193180 / hz;
       
        save_flags(flags);
        cli();
        del_timer(&sound_timer);
        if (count) {
                /* enable counter 2 */
                outb_p(inb_p(0x61)|3, 0x61);
                /* set command for counter 2, 2 byte write */
                outb_p(0xB6, 0x43);
                /* select desired HZ */
                outb_p(count & 0xff, 0x42);
                outb((count >> & 0xff, 0x42);

                if (ticks) {
                        sound_timer.expires = jiffies+ticks;
                        add_timer(&sound_timer);
                }
        } else
                kd_nosound(0);
        restore_flags(flags);
        return;
}

#else

void
_kd_mksound(unsigned int hz, unsigned int ticks)
{
}

now what you should do is to delete the implementation of the fuction _kd_mksound() before "#else" and then rebuid your kernel
(the code after being deleted looks like:

#if defined(__i386__) || defined(__alpha__) || defined(CONFIG_PPC_ISATIMER) \
    || (defined(__mips__) && defined(CONFIG_ISA)) \
    || (defined(__arm__) && defined(CONFIG_HOST_FOOTBRIDGE)) \
    || defined(__x86_64__)

static void
kd_nosound(unsigned long ignored)
{
        /* disable counter 2 */
        outb(inb_p(0x61)&0xFC, 0x61);
        return;
}

void
_kd_mksound(unsigned int hz, unsigned int ticks)
{
}

#else

void
_kd_mksound(unsigned int hz, unsigned int ticks)
{
}
or more simply:

#if defined(__i386__) || defined(__alpha__) || defined(CONFIG_PPC_ISATIMER) \
    || (defined(__mips__) && defined(CONFIG_ISA)) \
    || (defined(__arm__) && defined(CONFIG_HOST_FOOTBRIDGE)) \
    || defined(__x86_64__)

static void
kd_nosound(unsigned long ignored)
{
        /* disable counter 2 */
        outb(inb_p(0x61)&0xFC, 0x61);
        return;
}
#endif

void
_kd_mksound(unsigned int hz, unsigned int ticks)
{
}
)
conke,

哇,太感谢您了!

“There is only one OS,linux, that runs on my PC these years. ”
你真行!PFPF!
Here are the suggestions so far:

GNOME
-----
    Control Center|Peripherals|Keyboard|Keyboard bell

GNOME terminal
--------------
    Settings|Preferences|Silence Terminal Bell

xterm  (put in ~/.xsession)
-----
    xset b off

bash  (put in /etc/inputrc or ~/.inputrc )
----
    set bell-style none

tcsh   (put in ~/.cshrc
----
    set nobeep

vim   (put in ~/.vimrc)
---
    set vb

all
---
    (tear out speakers)