Load all modules at a location

Tuesday, 4. May 2010

If you’d like to load all modules under a particular path, you may use the following command.

loc="/lib/modules/`uname -r`/kernel/net/netfilter";
for i in `find $loc -iname '*ko'`; do
mod=`basename $i|sed s/\.ko//`;
echo -n $mod...;
sudo modprobe $mod;
echo loaded;
done

This command includes a sudo, which you’d want to remove if you don’t use it. (Clearly, you’d have to run it as root in that case.)

Leave a Reply