Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to write a bash startup script in Ubuntu 9.04 that will remove the annoying system beep from my computer:


rmmod pcspkr #remove system beep; also doesnt work without root access

it keeps coming back when I start my computer back on, and I want to run a startup script to remove this annoyance. But I do not know how to run as root in bash scripting, does anyone know how to log on as root in bash scripting?

share|improve this question
up vote 10 down vote accepted

Add this to the end of /etc/modprobe.d/blacklist:

blacklist pcspkr

This will prevent the pc speaker module from being loaded when you start the computer.

share|improve this answer
Agree, it's better to not load the module than to load and then unload it. – pgs Jul 2 '09 at 2:49
  1. Try System ==> Preferences ==> Startup Applications; You might be able to put your command right there...
  2. Check this post describing a /etc/init.d path for one more option
  3. You could add it to the root cron job (but that will go better with a module check).

do not have a Ubuntu handy to try this now.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.