How to determine if a specific module is loaded in linux kernel

前端 未结 9 1603
谎友^
谎友^ 2021-02-01 14:28

I am just curious is there any way to determine if a particular module is loaded/installed.

$lsmod lists all modules (device driver loaded).

Is there any way to

9条回答
  •  太阳男子
    2021-02-01 14:47

    The better idea is to create a bash function:

    #!/bin/sh
    function moduleExist(){
      MODULE="$1"
      if lsmod | grep "$MODULE" &> /dev/null ; then
        return 0
      else
        return 1
      fi
    }
    
    
    if moduleExist "module name"; then
      #do somthing
    fi
    

提交回复
热议问题