×

使用modprobe命令来添加、删除模块

hqy hqy 发表于2020-01-20 17:20:01 浏览2592 评论0

抢沙发发表评论

系统环境:Red Hat Enterprise Linux Server release 6.0

[root@localhost huage]# lsmod               //列出当前系统已加载的模块

Module                  Size  Used by

usb_storage            39114  

cdrom                  34035  sr_mod

。。。。。。

。。。。。。

。。。。。。

 

[root@localhost huage]# lsmod |grep usb

usb_storage            39114  

[root@localhost huage]# lsmod |grep usb_storage      

usb_storage            39114  

[root@localhost huage]# lsmod |grep usb-storage

//使用grep过滤输出时,下划线和中划线意义完全不一样

 

[root@localhost huage]# modprobe -r usb_storage     //删除模块;删除模块时需要加‘-r’参数

[root@localhost huage]# lsmod |grep usb

[root@localhost huage]# modprobe usb-storage          //添加模块;添加模块时,直接加模块名就可以了

[root@localhost huage]# lsmod |grep usb

usb_storage            39114  

//使用modprobe命令添加或删除模块时,‘_’‘-’没有区别,即下划线和中划线没有区别

 

[root@localhost huage]# man modprobe

DESCRIPTION(只节选了部分)

       modprobe intelligently adds or removes module  from  the  Linux

       kernel: note that for convenience, there is no difference between

       and in module names.  modprobe looks in the module  directory

       /lib/modules/?.name  -r?. for  all  the  modules and other files,

       except for the optional /etc/modprobe.conf configuration file and

       /etc/modprobe.d  directory  (see modprobe.conf(5)). modprobe will

       also use module options specified on the kernel command  line  in

       the form of <module>.<option>.

-r --remove

              This option causes modprobe to remove rather than insert a

              module. If the modules it depends on are also unused, mod-

              probe  will try to remove them too. Unlike insertion, more

              than one module can be specified on the command  line  (it

              does  not  make  sense  to  specify module parameters when

              removing modules).

 

              There is usually no reason to  remove  modules,  but  some

              buggy  modules  require  it.  Your  kernel may not support

              removal of modules.     


 您阅读本篇文章共花了: 

打赏

本文链接:https://kinber.cn/post/1165.html 转载需授权!

分享到:


推荐本站淘宝优惠价购买喜欢的宝贝:

image.png

群贤毕至

访客