Skip to content

Instantly share code, notes, and snippets.

@jrelo
Last active April 20, 2017 00:17
Show Gist options
  • Select an option

  • Save jrelo/539ec57c0b2e11ce889cf1953efef004 to your computer and use it in GitHub Desktop.

Select an option

Save jrelo/539ec57c0b2e11ce889cf1953efef004 to your computer and use it in GitHub Desktop.
modprobe -l replacement
#!/bin/bash
#
# find_all_modules.sh
#
for i in `find /sys/ -name modalias -exec cat {} \;`; do
/sbin/modprobe --config /dev/null --show-depends $i ;
done | rev | cut -f 1 -d '/' | rev | sort -u
find /lib/modules/$(uname -r)/kernel -type f -printf '%f\n' | sort | while read mod;do [ $(lsmod | grep -c ${mod/.ko/}) -ge 1 ] && echo "$mod (loaded)" || echo "$mod";done | tee /tmp/modules.out
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment