Linux modprobe Command Examples to View, Install, Remove Modules
2014-05-12 10:57
393 查看
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 | less kernel/arch/x86/kernel/cpu/mcheck/mce-inject.ko kernel/arch/x86/kernel/cpu/cpufreq/e_powersaver.ko kernel/arch/x86/kernel/cpu/cpufreq/p4-clockmod.ko kernel/arch/x86/kernel/msr.ko kernel/arch/x86/kernel/cpuid.ko kernel/arch/x86/kernel/apm.ko kernel/arch/x86/kernel/scx200.ko kernel/arch/x86/kernel/microcode.ko kernel/arch/x86/crypto/aes-i586.ko kernel/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 | less soundcore 7264 1 snd ppdev 6688 0 snd_page_alloc 9156 1 snd_pcm psmouse 56180 0 lp 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 vmhgfsOnce a module is loaded, verify it using lsmod command as shown below.
$ lsmod | grep vmhgfs vmhgfs 50772 0The 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 vmhgfs misc/vmhgfs.ko $ cd /lib/modules/2.6.31-14-generic/misc $ ls vmhgfs* vmhgfs.koNote: 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_hgfs vm_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
- RPM Command: 15 Examples to Install, Uninstall, Upgrade, Query RPM Packages
- BUG: You receive an "HTTP 500 - Internal server error" error message when you try to view an ASP page after you install Visual S
- android-错误:refused to install the app by The ADB command !
- What CommandName's to use in a FormView
- How to use the cut command with examples
- 171.View the Exhibit and examine the command used to create the ZONEDATA table.
- How to view or edit pdf/image metadata from command line on Linux
- 15 Linux Yum Command Examples – Install, Uninstall, Update Packages
- android-错误:refused to install the app by The ADB command !
- How to View / Disconnect Remote Desktop Sessions from Commandline
- 使用VLC命令行做流化:Streaming HowTo/Command Line Examples
- 10 examples to help you understand top command usage in Unix/Linux
- How to find PID of process listening on a port in Linux? netstat and lsof command examples
- How To Use Ip Command In Linux with Examples
- How to create new view by using cleartool command in Clearcase?
- HowTo: Use grep Command In Linux / UNIX [ Examples ]
- How to install zip and unzip command in Linux?
- Linux fdisk Command Examples to Manage Hard Disk Partition
- How to view the schema class or attribute definition you first have to install the Active Directory Schema snap-in