Linux modprobe Command Examples to View, Install, Remove Modules
来源:互联网 发布:网吧指纹软件申报 编辑:程序博客网 时间:2024/05/18 00:50
modprobe utility is used to add loadable modules to the Linux kernel. You can also view and remove modules using modprobe command.
Linux maintains /lib/modules/$(uname-r) directory for modules and its configuration files (except /etc/modprobe.conf and /etc/modprobe.d).
In Linux kernel 2.6, the .ko modules are used instead of .o files since that has additional information that the kernel uses to load the modules. The example in this article are done with using modprobe on Ubuntu.
1. List Available Kernel Modules
modprobe -l will display all available modules as shown below.
$ modprobe -l | lesskernel/arch/x86/kernel/cpu/mcheck/mce-inject.kokernel/arch/x86/kernel/cpu/cpufreq/e_powersaver.kokernel/arch/x86/kernel/cpu/cpufreq/p4-clockmod.kokernel/arch/x86/kernel/msr.kokernel/arch/x86/kernel/cpuid.kokernel/arch/x86/kernel/apm.kokernel/arch/x86/kernel/scx200.kokernel/arch/x86/kernel/microcode.kokernel/arch/x86/crypto/aes-i586.kokernel/arch/x86/crypto/twofish-i586.ko
2. List Currently Loaded Modules
While the above modprobe command shows all available modules, lsmod command will display all modules that are currently loaded in the Linux kernel.
$ lsmod | lesssoundcore 7264 1 sndppdev 6688 0snd_page_alloc 9156 1 snd_pcmpsmouse 56180 0lp 8964 0
3. Install New modules into Linux Kernel
In order to insert a new module into the kernel, execute the modprobe command with the module name.
Following example loads vmhgfs module to Linux kernel on Ubuntu.
$ sudo modprobe vmhgfs
Once a module is loaded, verify it using lsmod command as shown below.
$ lsmod | grep vmhgfsvmhgfs 50772 0
The module files are with .ko extension. If you like to know the full file location of a specific Linux kernel module, use modprobe command and do a grep of the module name as shown below.
$ modprobe | grep vmhgfsmisc/vmhgfs.ko$ cd /lib/modules/2.6.31-14-generic/misc$ ls vmhgfs*vmhgfs.ko
Note: You can also use insmod for installing new modules into the Linux kernel.
4. Load New Modules with the Different Name to Avoid Conflicts
Consider, in some cases you are supposed to load a new module but with the same module name another module got already loaded for different purposes.
If for some strange reasons, the module name you are trying to load into the kernel is getting used (with the same name) by a different module, then you can load the new module using a different name.
To load a module with a different name, use the modprobe option -o as shown below.
$ sudo modprobe vmhgfs -o vm_hgfs$ lsmod | grep vm_hgfsvm_hgfs 50772 0
5. Remove the Currently Loaded Module
If you’ve loaded a module to Linux kernel for some testing purpose, you might want to unload (remove) it from the kernel.
Use modprobe -r option to unload a module from the kernel as shown below.
modprobe -r vmhgfs
- Linux modprobe Command Examples to View, Install, Remove Modules
- 5 Linux Touch Command Examples (How to Change File Timestamp)
- UNIX / Linux chfn Command Examples to Change User Finger Info
- How To Use Ip Command In Linux with Examples
- How to Backup Linux? 15 rsync Command Examples
- RPM Command: 15 Examples to Install, Uninstall, Upgrade, Query RPM Packages
- Configure the modules to be find by modprobe
- How to Navigate Linux Command Line Using Keybinding (Linux Ctrl Command Examples)
- linux ps command useful examples
- Linux / Unix: chroot Command Examples
- How to install zip and unzip command in Linux?
- Linux:install command
- 10 examples to help you understand top command usage in Unix/Linux
- 12 Linux Which Command, Whatis Command, Whereis Command Examples
- How to Install Linux KVM and Create Guest VM with Examples
- 15 Practical Linux Find Command Examples
- UNIX / Linux: 10 Netstat Command Examples
- 15 Practical Linux cURL Command Examples
- 国务委员马凯-加快铁路建设推进政企分开改革-铁路建设-政企分开改革-马凯
- Objective-C中一种消息处理方法performSelector: withObject:
- H.264 基本流的结构
- Admin管理后台模板 Free HTML Admin Templates For The Backend Of Your Apps
- 通过取得MAC地址判断是否在VM中
- Linux modprobe Command Examples to View, Install, Remove Modules
- android Memory Management, OutOfMemoryError Note
- [VS2010]提示未找到标示符问题
- gluPerspective和gluLookAt的关系
- Android-图像识别项目OpenCV(2):运行官方例子中的脸部识别程序
- PowerDesigner配置递增字段和设置索引
- 安倍要美副国务卿转告中国-一厘米土地也不让-安倍晋三-一厘米土地-美国
- QX项目实战-2.模块分类以及配置读取
- 需求与设计过程(1)-用例