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?

2 Answers 2


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.

  • Agree, it's better to not load the module than to load and then unload it.
    – pgs
    Jul 2, 2009 at 2:49
  1. Try System ==> Preferences ==> Startup Applications; You might be able to put your command right there...
    • Check this post describing a /etc/init.d path for one more option
    • 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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy