The insmod Command
The insmod command is used to insert modules into the kernel. Kernel modules are usually used to add support for new hardware (as device drivers) and/or filesystems, or for adding system calls. This command inserts the kernel object file (.ko) into the kernel.
insmod [file name] [module-options...]
There are only 2 options - on -h for help, and -V fto show the version of insmod.
This example shows running the insmod command from the /lib/modules/$(uname -r) directory, and that the .ko file exists in the specified directory.
pbmac@pbmac-server $ insmod kernel/drivers/net/wireless/airo.ko pbmac@pbmac-server $ lsmod | grep axnet Module Size Used by airo 66291 0
The rmmod Command
The rmmod command is used to remove a module from the kernel. Most of the users use modprobe with the -r option instead of using rmmod.
rmmod [-f] [-s] [-v] [modulename]
The rmmod command is extremely simple. You only need to give it the name of a module that you want to unload, and it will remove it. When you run the lsmod command looking for the module it should not find it. If you need the name, simply use lsmod to find the modules currently loaded, then remove the one you need.
pbmac@pbmac-server $ rmmod axnet pbmac@pbmac-server $ lsmod | grep axnet pbmac@pbmac-server $
"insmod command in Linux with examples" by Mukkesh Mckenzie, Geeks for Geeks is licensed under CC BY-SA 4.0
"rmmod command in Linux with Examples" by rahulkumarmandal, Geeks for Geeks is licensed under CC BY-SA 4.0