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

前端 未结 9 1772
谎友^
谎友^ 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:50

    The modinfo module method does not work well for me. I prefer this method that is similar to the alternative method proposed:

    #!/bin/sh
    
    MODULE="$1"
    
    if lsmod | grep "$MODULE" &> /dev/null ; then
      echo "$MODULE is loaded!"
      exit 0
    else
      echo "$MODULE is not loaded!"
      exit 1
    fi
    

提交回复
热议问题