命令行大全

lsmod

rose1 发表于 2020-09-25 09:03浏览次数:

在Linux操作系统上,lsmod命令列出了插入内核的模块的状态。

查看英文版

目录:

1 lsmod 运行系统环境

2 lsmod 说明

3 lsmod 语法

4 lsmod 例子

lsmod 运行系统环境

Linux

lsmod 说明

Linux内核模块(LKM)是系统级软件,可以由操作系统内核直接使用。可以将它们插入内核并激活,而无需重新引导系统。

lsmod没有选项。它格式化文件/ proc / modules的内容,其中包含有关所有当前加载的LKM的状态的信息。

Linux kernel modules (LKMs) are system-level software that can be used directly by operating system kernel. They can be inserted into the kernel and activated without the system needing to be rebooted.

lsmod has no options. It formats the contents of the file /proc/modules, which contains information about the status of all currently-loaded LKMs.

查看英文版

查看中文版

lsmod 语法

lsmod
lsmod

查看英文版

查看中文版

lsmod 例子

要列出所有活动的内核模块,请在命令行中运行lsmod

lsmod

这本质上与运行“ cat / proc / modules ”相同,但是信息的格式更好。您将看到三列信息:

  • Module:模块的名称。这通常是模块文件的名称,减去扩展名(.o或.ko),但是它可能具有自定义名称,当使用insmod命令插入模块时,可以将其指定为选项。
  • 大小:驻留模块使用的内存量,以字节为单位。
  • 使用者:此列包含一个数字,表示正在使用的模块实例数。如果数字为零,则当前未使用该模块。数字后的文字表示有关模块使用情况的任何可用信息:通常是设备名称,文件系统标识符或另一个模块的名称。

lsmod的输出将类似于以下内容:

Module                  Size  Used by
fuse                   52176  3 
cryptd                 14125  0 
aes_i586               16647  2 
aes_generic            32970  1 aes_i586
parport_pc             22036  0 
ppdev                  12651  0 
lp                     12797  0 
parport                31254  3 lp,ppdev,parport_pc
bnep                   17288  2 
rfcomm                 28626  0 
bluetooth             103791  10 rfcomm,bnep
cpufreq_conservative   12987  0 
cpufreq_stats          12762  0 
cpufreq_powersave      12422  0 
cpufreq_userspace      12520  0 
loop                   17810  0 
uvcvideo               56896  0 
videodev               61658  1 uvcvideo
media                  13692  2 videodev,uvcvideo
snd_hda_codec_realtek  142267 1 
arc4                   12418  2 
joydev                 17010  0 
ath9k                  58983  0 
snd_hda_intel          21786  2 
ath9k_common           12648  1 ath9k
snd_hda_codec          63477  2 snd_hda_intel,snd_hda_codec_realtek
ath9k_hw              311433  2 ath9k_common,ath9k
i915                  321557  3 
drm_kms_helper         22738  1 i915
drm                   146387  4 drm_kms_helper,i915
i2c_algo_bit           12713  1 i915
snd_hwdep              12943  1 snd_hda_codec
snd_pcm                53461  2 snd_hda_codec,snd_hda_intel
snd_page_alloc         12867  2 snd_pcm,snd_hda_intel
ath                    17114  3 ath9k_hw,ath9k_common,ath9k
mac80211              171389  1 ath9k
acer_wmi               21651  0 
sparse_keymap          12680  1 acer_wmi
iTCO_wdt               16945  0 
acpi_cpufreq           12807  1 
snd_seq                39512  0 
snd_seq_device         13016  1 snd_seq
snd_timer              22356  2 snd_seq,snd_pcm
snd                    42761  12 snd_timer,snd_seq_device,snd_seq,snd_pcm,snd_hwdep,snd_hda_codec,snd_hda_intel,snd_hda_codec_realtek
coretemp               12770  0 
cfg80211              113445  3 mac80211,ath,ath9k
rts_pstor             226667  0 
rfkill                 18516  5 cfg80211,acer_wmi,bluetooth
iTCO_vendor_support    12632  1 iTCO_wdt
i2c_i801               12670  0 
psmouse                59609  0 
i2c_core               19116  6 i2c_i801,i2c_algo_bit,drm,drm_kms_helper,i915,videodev
pcspkr                 12515  0 
soundcore              12921  1 snd
mperf                  12421  1 acpi_cpufreq
evdev                  17225  10 
serio_raw              12803  0 
ac                     12552  0 
processor              27565  1 acpi_cpufreq
video                  17459  1 i915
battery                12986  0 
power_supply           13283  2 battery,ac
wmi                    13051  1 acer_wmi
button                 12817  1 i915
ext4                  306996  2 
crc16                  12327  2 ext4,bluetooth
jbd2                   56426  1 ext4
mbcache                12938  1 ext4
microcode              17558  0 
hid_logitech_dj        13049  0 
usbhid                 31554  1 hid_logitech_dj
hid                    64284  2 usbhid,hid_logitech_dj
sg                     21476  0 
sd_mod                 35425  4 
crc_t10dif             12332  1 sd_mod
thermal                13103  0 
thermal_sys            17752  3 thermal,video,processor
uhci_hcd               22337  0 
ahci                   24917  3 
libahci                18373  1 ahci
libata                125014  2 libahci,ahci
ehci_hcd               39631  0 
usbcore               104555  5 ehci_hcd,uhci_hcd,usbhid,uvcvideo
scsi_mod              135081  4 libata,sd_mod,sg,rts_pstor
r8169                  41830  0 
mii                    12595  1 r8169
usb_common             12338  1 usbcore

To list all active kernel modules, run lsmod at the command line:

lsmod

This is essentially the same as running "cat /proc/modules", but the information is formatted a little nicer. You'll see three columns of information:

  • Module: the name of the module. This is usually the name of the module file, minus the extension (.o or .ko), but it may have a custom name, which can be specified as an option when the module is inserted with the insmod command.
  • Size: the amount of memory used by the resident module, in bytes.
  • Used by: This column contains a number representing how many instances of the module are being used. If the number is zero, the module is not currently being used. Text after the number represents any available information about what is using the module: this is commonly a device name, a filesystem identifier, or the name of another module.

Output of lsmod will resemble the following:

Module                  Size  Used by
fuse                   52176  3 
cryptd                 14125  0 
aes_i586               16647  2 
aes_generic            32970  1 aes_i586
parport_pc             22036  0 
ppdev                  12651  0 
lp                     12797  0 
parport                31254  3 lp,ppdev,parport_pc
bnep                   17288  2 
rfcomm                 28626  0 
bluetooth             103791  10 rfcomm,bnep
cpufreq_conservative   12987  0 
cpufreq_stats          12762  0 
cpufreq_powersave      12422  0 
cpufreq_userspace      12520  0 
loop                   17810  0 
uvcvideo               56896  0 
videodev               61658  1 uvcvideo
media                  13692  2 videodev,uvcvideo
snd_hda_codec_realtek  142267 1 
arc4                   12418  2 
joydev                 17010  0 
ath9k                  58983  0 
snd_hda_intel          21786  2 
ath9k_common           12648  1 ath9k
snd_hda_codec          63477  2 snd_hda_intel,snd_hda_codec_realtek
ath9k_hw              311433  2 ath9k_common,ath9k
i915                  321557  3 
drm_kms_helper         22738  1 i915
drm                   146387  4 drm_kms_helper,i915
i2c_algo_bit           12713  1 i915
snd_hwdep              12943  1 snd_hda_codec
snd_pcm                53461  2 snd_hda_codec,snd_hda_intel
snd_page_alloc         12867  2 snd_pcm,snd_hda_intel
ath                    17114  3 ath9k_hw,ath9k_common,ath9k
mac80211              171389  1 ath9k
acer_wmi               21651  0 
sparse_keymap          12680  1 acer_wmi
iTCO_wdt               16945  0 
acpi_cpufreq           12807  1 
snd_seq                39512  0 
snd_seq_device         13016  1 snd_seq
snd_timer              22356  2 snd_seq,snd_pcm
snd                    42761  12 snd_timer,snd_seq_device,snd_seq,snd_pcm,snd_hwdep,snd_hda_codec,snd_hda_intel,snd_hda_codec_realtek
coretemp               12770  0 
cfg80211              113445  3 mac80211,ath,ath9k
rts_pstor             226667  0 
rfkill                 18516  5 cfg80211,acer_wmi,bluetooth
iTCO_vendor_support    12632  1 iTCO_wdt
i2c_i801               12670  0 
psmouse                59609  0 
i2c_core               19116  6 i2c_i801,i2c_algo_bit,drm,drm_kms_helper,i915,videodev
pcspkr                 12515  0 
soundcore              12921  1 snd
mperf                  12421  1 acpi_cpufreq
evdev                  17225  10 
serio_raw              12803  0 
ac                     12552  0 
processor              27565  1 acpi_cpufreq
video                  17459  1 i915
battery                12986  0 
power_supply           13283  2 battery,ac
wmi                    13051  1 acer_wmi
button                 12817  1 i915
ext4                  306996  2 
crc16                  12327  2 ext4,bluetooth
jbd2                   56426  1 ext4
mbcache                12938  1 ext4
microcode              17558  0 
hid_logitech_dj        13049  0 
usbhid                 31554  1 hid_logitech_dj
hid                    64284  2 usbhid,hid_logitech_dj
sg                     21476  0 
sd_mod                 35425  4 
crc_t10dif             12332  1 sd_mod
thermal                13103  0 
thermal_sys            17752  3 thermal,video,processor
uhci_hcd               22337  0 
ahci                   24917  3 
libahci                18373  1 ahci
libata                125014  2 libahci,ahci
ehci_hcd               39631  0 
usbcore               104555  5 ehci_hcd,uhci_hcd,usbhid,uvcvideo
scsi_mod              135081  4 libata,sd_mod,sg,rts_pstor
r8169                  41830  0 
mii                    12595  1 r8169
usb_common             12338  1 usbcore

查看英文版

查看中文版