modprobe 命令用于管理 Linux 系统内核模块。它可以插入(加载)或删除已编译并存在于内核模块目录中的模块。以下是 modprobe 命令的一些常用用法:
加载一个模块:
sudo modprobe module_name
这将加载名为 module_name 的模块并将其插入内核中。
卸载一个模块:
sudo modprobe -r module_name
作用等同于
sudo rmmod module_name
这将从内核中卸载名为 module_name 的模块。
列出当前已经加载的模块:
lsmod
这将显示当前已经加载的所有模块的列表。
显示有关某个模块的信息:
modinfo module_name
这将显示名为 module_name 的模块相关的信息,如版本号、作者、描述等。
强制加载一个模块:
sudo modprobe -f module_name
这将使用 force 选项强制加载名为 module_name 的模块,并覆盖任何与之冲突的模块。
这些命令只是 modprobe 命令的一部分用法,如果想了解更多详细的用法和选项,可以参考 modprobe 的 man 手册页或 -h help页面
root@unassigned:~# modprobe -h
Usage:
modprobe [options] [-i] [-b] modulename
modprobe [options] -a [-i] [-b] modulename [modulename...]
modprobe [options] -r [-i] modulename
modprobe [options] -r -a [-i] modulename [modulename...]
modprobe [options] -c
modprobe [options] --dump-modversions filename
Management Options:
-a, --all Consider every non-argument to
be a module name to be inserted
or removed (-r)
-r, --remove Remove modules instead of inserting
--remove-dependencies Also remove modules depending on it
-R, --resolve-alias Only lookup and print alias and exit
--first-time Fail if module already inserted or removed
-i, --ignore-install Ignore install commands
-i, --ignore-remove Ignore remove commands
-b, --use-blacklist Apply blacklist to resolved alias.
-f, --force Force module insertion or removal.
implies --force-modversions and
--force-vermagic
--force-modversion Ignore module's version
--force-vermagic Ignore module's version magic
Query Options:
-D, --show-depends Only print module dependencies and exit
-c, --showconfig Print out known configuration and exit
-c, --show-config Same as --showconfig
--show-modversions Dump module symbol version and exit
--dump-modversions Same as --show-modversions
General Options:
-n, --dry-run Do not execute operations, just print out
-n, --show Same as --dry-run
-C, --config=FILE Use FILE instead of default search paths
-d, --dirname=DIR Use DIR as filesystem root for /lib/modules
-S, --set-version=VERSION Use VERSION instead of `uname -r`
-s, --syslog print to syslog, not stderr
-q, --quiet disable messages
-v, --verbose enables more messages
-V, --version show version
-h, --help show this help
root@unassigned:~#