I know that one should never want to do this, but I need to run a command as root at startup. For some reason the driver for my wifi card isnt recognized so to get it up and running I have to run

sudo modprobe <drivername>

each time i boot.

How do I automate this? I don't think I can add a root command to my bash profile.

Side note: Extra points if you can tell me how to do this in fish shell.


2 Answers 2


I know this answers your problem (rather than the question), but if you want a module to be loaded at startup, simply add it to the file /etc/modules


# /etc/modules: kernel modules to load at boot time.
# This file contains the names of kernel modules that should be loaded
# at boot time, one per line. Lines beginning with "#" are ignored.

<drivername>   <--- **here**

First you need to add a user yo run as root without a password and assign the program.

username ALL=(ALL:ALL) 


Replace username and /path/to/ with real values.

Then you can add the program to your startup programs.

Open the Dash type: "Startup Applications"

Now click on Add and give in the command to run that runs application.

Not the answer you're looking for? Browse other questions tagged or ask your own question.