Solved

Command Line Beeping

Posted on 2003-11-30
16
6,790 Views
Last Modified: 2007-12-19
Hey everyone -

I assume this is probably a pretty easy question to answer, as it is probably just setting a 1 to 0 in some file, but I can't find where.  My command line will let out this annyoing 'BEEP' everytime I do something wrong.  (Like try and continue to scroll after I have reached the bottom of a file in vi, or hitting TAB when there is more than one file to list, etc...)

Anyway, as this is a laptop, it is extremely annoying to have happen when I am somewhere like a restauraunt.  Is there a way to turn this beeping off?

~ace
0
Comment
Question by:Topace
  • 6
  • 3
  • 2
  • +3
16 Comments
 
LVL 12

Expert Comment

by:paullamhkg
ID: 9847386
will there any sound/volume control on your laptop? normal on the side of your laptop try to use the control to turn your laptop sound off or to the lowest.
0
 
LVL 1

Author Comment

by:Topace
ID: 9847443
no all the sound control is in the os

~ace
0
 
LVL 12

Expert Comment

by:paullamhkg
ID: 9848359
have a check here http://www.linuxgazette.com/issue47/ayers.html#ayers2 but it only for play music on command line, and you need to install software into your OS.
0
 
LVL 20

Accepted Solution

by:
Gns earned 50 total points
ID: 9848913
As I understand this, you want to avoid an audible... This is a "properety" of your shell (the actual ringing of the terminal bell).
Assuming you are using bash, it isn't actually the shell that keep ringing your bell... rather it is the readline library (incorporated for things like eiting command history etc)... Perhaps the following snippet from the bash man-page would help:
----------------------------
       bell-style (audible)
              Controls  what  happens when readline wants to ring
              the terminal bell.  If set to none, readline  never
              rings the bell.  If set to visible, readline uses a
              visible bell if one is available.  If set to  aud­
              ble, readline attempts to ring the terminal's bell.
----------------------------
So add the following (or chage it if already there:-):
set bell-style none
in your $HOME/.inputrc, and those pesky beeps should go away;-).

-- Glenn
0
 
LVL 17

Expert Comment

by:owensleftfoot
ID: 9858996
Gns, the above will only work if he is in a virtual console. If he is running from a terminal in X he needs to put the line "xset b off" in one of his X startup files such as .xinitrc or .xsession.
0
 
LVL 17

Expert Comment

by:owensleftfoot
ID: 9858997
Gns, the above will only work if he is in a virtual console. If he is running from a terminal in X he needs to put the line "xset b off" in one of his X startup files such as .xinitrc or .xsession.
0
 
LVL 20

Expert Comment

by:Gns
ID: 9859551
No. The xset setting will take precedence under X, but the readline setting will prevent bash (and anything else using readline) from even trying to ring the bell. So one might say its the other way around:-)... "xset b off" will only work for X, while "set bell-style none" will work anywhere:-):-).
Best solution would probably be a combination;).

-- Glenn
0
What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

 
LVL 17

Expert Comment

by:owensleftfoot
ID: 9859641
I set "bell style none" but couldnt get the bloody thing to stop beeping under X until the "xset b off". Its a mystery :)
0
 
LVL 20

Expert Comment

by:Gns
ID: 9859737
Yes... I do believe I've got this working... checking... Oh, I see a possibility... Did you remember to restart the shell (logout/login)? Just checked on a Mdk9.2, and both the .inputrc and xset things work as expected (ie: as I/the docs say:-).

-- Glenn
0
 
LVL 20

Expert Comment

by:Gns
ID: 9859938
... and you (for the xset thing... not trying to usurp anything here:-).

-- Glenn
0
 
LVL 5

Expert Comment

by:paulqna
ID: 9860286
All you need is the escape sequences:

Per-console Beep Configuration

  As of Linux 1.3.43, Martin Mares added configurability to the bell
  sound in console.c. You can change the duration and pitch of the
  console beep on a per-console basis, by writing escape sequences to
  the tty. You can apply your configuration in your own ~/.profile or
  ~/.login, to have a different beep (or no beep) associated to each
  console.

  The escape sequences work as follow:

  ·  ESC-[10;xx] chooses the bell frequency in Hertz. The value should
     be in the range 21-32766, otherwise the result is undefined (at
     least up to the 2.0.x version -- I can't foresee the future.  If
     the `xx' argument is missing, the default value (750Hz) will apply,
     as in `ESC-[10].

  ·  ESC-[11;xx] chooses the bell duration, in milli-seconds.  If you
     specify more than 2 seconds, the default applies (125ms). Once
     again, if the `xx' argument is missing (ESC-[11]) the default value
     will be used.

  To print the escape sequences, you can try for example (50Hz, 1s)
  "echo -e "\33[10;50]\33[11;1000]"" with bash (where "-e" means
  `understand escape sequences'. With tcsh "echo
  " 33[10;50] 33[11;1000]" will have the same effect.

  Note that a new `setterm' command might support bell configuration of
  command line, as these control codes are marked as `setterm-commands'.
  However, no `setterm' version I know of supports these codes.

  If you run Linux-1.3.43 or newer, you may be satisfied with the escape
  sequences and avoid reading further. If you run an older kernel (I do
  it myself, on a small 386), or if you want the visual bell, have a
  good reading.
0
 
LVL 5

Expert Comment

by:paulqna
ID: 9860296
whoops forget that, misunderstood question completely...
0
 
LVL 20

Expert Comment

by:Gns
ID: 9864959
;-)

-- Glenn
0
 
LVL 1

Expert Comment

by:ajenkins
ID: 9883032
echo 0 >/proc/sys/dev/speaker/beep
0
 
LVL 20

Expert Comment

by:Gns
ID: 10182280
Clearly answered (no refund)... Possibly a split.

-- Glenn
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Linux users are sometimes dumbfounded by the severe lack of documentation on a topic. Sometimes, the documentation is copious, but other times, you end up with some obscure "it varies depending on your distribution" over and over when searching for …
It’s 2016. Password authentication should be dead — or at least close to dying. But, unfortunately, it has not traversed Quagga stage yet. Using password authentication is like laundering hotel guest linens with a washboard — it’s Passé.
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now