Linux: How to find the device driver used for a device? Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern) 2019 Community Moderator Election Results Why I closed the “Why is Kali so hard” questionDetermine driver for network interfaceFind driver (which is not automatically installed) for a specific hardwarerootfs.jffs2 files system won't fit in mtd3How does Dolphin discover the disks to mount?Find out why linux kernel module was loadedRyzen/Threadripper temperature sensors: Which senors are related to which kernel modules and how to enable themConnect alauda driver to an mtd deviceWhere can I find information on Linux device driver parameters?Where can I find the Linux driver for headphones in the kernel tree?How driver is specified for any device?leds-pwm driver in linux 3.8How to find the driver (module) associated with SATA device on Linux?Trying to understand how Device Drivers workWhy is a filesystem in linux not classified as a device driver?Do vendor id and product id alone determine the driver used for a USB device?How does linux uses device files stored in /dev?
Can a new player join a group only when a new campaign starts?
How can I use the Python library networkx from Mathematica?
Why are both D and D# fitting into my E minor key?
If a VARCHAR(MAX) column is included in an index, is the entire value always stored in the index page(s)?
Is the Standard Deduction better than Itemized when both are the same amount?
What does the "x" in "x86" represent?
Why aren't air breathing engines used as small first stages
Denied boarding although I have proper visa and documentation. To whom should I make a complaint?
Delete nth line from bottom
Where are Serre’s lectures at Collège de France to be found?
また usage in a dictionary
Do wooden building fires get hotter than 600°C?
When the Haste spell ends on a creature, do attackers have advantage against that creature?
Trademark violation for app?
Would "destroying" Wurmcoil Engine prevent its tokens from being created?
What does "lightly crushed" mean for cardamon pods?
Chinese Seal on silk painting - what does it mean?
Extracting terms with certain heads in a function
Closed form of recurrent arithmetic series summation
How to compare two different files line by line in unix?
How do I find out the mythology and history of my Fortress?
Is it common practice to audition new musicians one-on-one before rehearsing with the entire band?
How to answer "Have you ever been terminated?"
Why are the trig functions versine, haversine, exsecant, etc, rarely used in modern mathematics?
Linux: How to find the device driver used for a device?
Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern)
2019 Community Moderator Election Results
Why I closed the “Why is Kali so hard” questionDetermine driver for network interfaceFind driver (which is not automatically installed) for a specific hardwarerootfs.jffs2 files system won't fit in mtd3How does Dolphin discover the disks to mount?Find out why linux kernel module was loadedRyzen/Threadripper temperature sensors: Which senors are related to which kernel modules and how to enable themConnect alauda driver to an mtd deviceWhere can I find information on Linux device driver parameters?Where can I find the Linux driver for headphones in the kernel tree?How driver is specified for any device?leds-pwm driver in linux 3.8How to find the driver (module) associated with SATA device on Linux?Trying to understand how Device Drivers workWhy is a filesystem in linux not classified as a device driver?Do vendor id and product id alone determine the driver used for a USB device?How does linux uses device files stored in /dev?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
If my target has one device connected and many drivers for that device loaded, how can I understand what device is using which driver?
linux linux-kernel
migrated from stackoverflow.com Jun 28 '12 at 8:37
This question came from our site for professional and enthusiast programmers.
add a comment |
If my target has one device connected and many drivers for that device loaded, how can I understand what device is using which driver?
linux linux-kernel
migrated from stackoverflow.com Jun 28 '12 at 8:37
This question came from our site for professional and enthusiast programmers.
add a comment |
If my target has one device connected and many drivers for that device loaded, how can I understand what device is using which driver?
linux linux-kernel
If my target has one device connected and many drivers for that device loaded, how can I understand what device is using which driver?
linux linux-kernel
linux linux-kernel
edited Jun 30 '12 at 12:56
Alexios
14.7k15068
14.7k15068
asked Jun 27 '12 at 6:17
Deepu
migrated from stackoverflow.com Jun 28 '12 at 8:37
This question came from our site for professional and enthusiast programmers.
migrated from stackoverflow.com Jun 28 '12 at 8:37
This question came from our site for professional and enthusiast programmers.
add a comment |
add a comment |
6 Answers
6
active
oldest
votes
Just use /sys
.
Example. I want to find the driver for my Ethernet card:
$ sudo lspci
...
02:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168B PCI Express Gigabit Ethernet controller (rev 01)
$ find /sys | grep drivers.*02:00
/sys/bus/pci/drivers/r8169/0000:02:00.0
That is r8169
.
First I need to find coordinates of the device using lspci
; then I find driver that is used for the devices with these coordinates.
32
lspci -v
does it by itself.
– poige
Jul 1 '12 at 4:50
6
lspci -nk
will show you attached drivers. In general the sysfs is the right place to search for.
– 0andriy
Nov 18 '15 at 20:03
@AndyShevchenko thank you! This will be a great timesaver for me :-D
– pepoluan
Nov 29 '16 at 3:19
1
I know the OP asked for "drivers being used", but what if the driver is not installed nor being used? How to find out just by thevendorID:productID
? Also, what if it is not a PCI device, and you only see it inlsusb
for example?
– Dr Beco
Jun 26 '17 at 18:48
1
@DrBeco: But if driver is not installed, what do you want to find? You should just google in this case
– Igor Chubin
Jun 27 '17 at 15:18
|
show 2 more comments
Here's a little script I wrote:
#!/bin/bash
for f in /sys/class/net/*; do
dev=$(basename $f)
driver=$(readlink $f/device/driver/module)
if [ $driver ]; then
driver=$(basename $driver)
fi
addr=$(cat $f/address)
operstate=$(cat $f/operstate)
printf "%10s [%s]: %10s (%s)n" "$dev" "$addr" "$driver" "$operstate"
done
Sample output:
$ ~/what_eth_drivers.sh
eth0 [52:54:00:aa:bb:cc]: virtio_net (up)
eth1 [52:54:00:dd:ee:ff]: virtio_net (up)
eth2 [52:54:00:99:88:77]: virtio_net (up)
lo [00:00:00:00:00:00]: (unknown)
1
I much prefer reading links to finding/grepping. Nice solution.
– Chris Mendez
Jan 29 '16 at 16:24
Thanks! Way better than the unreliable 'dmesg|grep' (ring buffer...)
– Dominik R
Feb 10 '16 at 15:04
I'd like to find solution which would find alsoveth
and other virtual drivers. IMHO the only solution is to useethtool
orlshw
.
– pevik
Jul 20 '17 at 21:37
add a comment |
sudo lspci -v
will show it. like this:
$ sudo lspci -v
00:01.0 VGA compatible controller: Advanced Micro Devices, Inc......
...
Kernel driver in use: radeon
Kernel modules: radeon
You can also combine it with grep
like this:
$ sudo lspci -v | grep -A 20 VGA
add a comment |
If you just want to plainly use sysfs and doesn't want to deal with all these commands which eventually looks inside sysfs anyways, here's how:
say, what is the module/driver for eth6? "sfc" it is
# ls -l /sys/class/net/eth6/device/driver
lrwxrwxrwx 1 root root 0 Jan 22 12:30 /sys/class/net/eth6/device/driver ->
../../../../bus/pci/drivers/sfc
or better yet.. let readlink resolve the path for you.
# readlink -f /sys/class/net/eth6/device/driver
/sys/bus/pci/drivers/sfc
so... to figure out what are the drivers for all of your network interfaces:
# ls -1 /sys/class/net/ | grep -v lo | xargs -n1 -I bash -c 'echo -n :" " ; basename `readlink -f /sys/class/net//device/driver`'
eth0 : tg3
eth1 : tg3
eth10 : mlx4_core
eth11 : mlx4_core
eth2 : tg3
eth3 : tg3
eth4 : mlx4_core
eth5 : mlx4_core
eth6 : sfc
eth7 : sfc
eth8 : sfc
eth9 : sfc
how is this one better than the one Jonathan Reinhart posted ? unix.stackexchange.com/a/225496/47663
– nhed
Feb 8 '18 at 4:58
Probably same... but I love one liner... I can easily adjust things right at the command line... just for those who don't have time to open a file and write a script.
– Monty Montemayor
Feb 13 '18 at 17:37
add a comment |
You can use the lsmod
command to get the status of loaded modules / devices drivers in the Linux Kernel.
For a specific device, you can use dmesg |grep <device-name>
to get the details too.
1
Thanks. But if i loaded two drivers for a device with same major no and different minor no ,and if only one driver is being used for the device ,how can I find which driver is used for that device?
– Deepu
Jun 27 '12 at 6:34
perhaps this SO question can help you further.
– gkris
Jun 27 '12 at 6:49
If your system has not been online so long that the ring buffer has re-started, sure dmesg | grep <device-name> will work ; this doesn't work on any of my routers, however.
– cjac
Mar 7 '16 at 1:47
add a comment |
For USB based devices you can see the driver name by using the lsusb
command:
lsusb -t
And/or you use lshw
which enumerates the devices on all buses including USB, PCI, etc so you can see which driver it uses:
sudo lshw
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "106"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f41817%2flinux-how-to-find-the-device-driver-used-for-a-device%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
6 Answers
6
active
oldest
votes
6 Answers
6
active
oldest
votes
active
oldest
votes
active
oldest
votes
Just use /sys
.
Example. I want to find the driver for my Ethernet card:
$ sudo lspci
...
02:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168B PCI Express Gigabit Ethernet controller (rev 01)
$ find /sys | grep drivers.*02:00
/sys/bus/pci/drivers/r8169/0000:02:00.0
That is r8169
.
First I need to find coordinates of the device using lspci
; then I find driver that is used for the devices with these coordinates.
32
lspci -v
does it by itself.
– poige
Jul 1 '12 at 4:50
6
lspci -nk
will show you attached drivers. In general the sysfs is the right place to search for.
– 0andriy
Nov 18 '15 at 20:03
@AndyShevchenko thank you! This will be a great timesaver for me :-D
– pepoluan
Nov 29 '16 at 3:19
1
I know the OP asked for "drivers being used", but what if the driver is not installed nor being used? How to find out just by thevendorID:productID
? Also, what if it is not a PCI device, and you only see it inlsusb
for example?
– Dr Beco
Jun 26 '17 at 18:48
1
@DrBeco: But if driver is not installed, what do you want to find? You should just google in this case
– Igor Chubin
Jun 27 '17 at 15:18
|
show 2 more comments
Just use /sys
.
Example. I want to find the driver for my Ethernet card:
$ sudo lspci
...
02:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168B PCI Express Gigabit Ethernet controller (rev 01)
$ find /sys | grep drivers.*02:00
/sys/bus/pci/drivers/r8169/0000:02:00.0
That is r8169
.
First I need to find coordinates of the device using lspci
; then I find driver that is used for the devices with these coordinates.
32
lspci -v
does it by itself.
– poige
Jul 1 '12 at 4:50
6
lspci -nk
will show you attached drivers. In general the sysfs is the right place to search for.
– 0andriy
Nov 18 '15 at 20:03
@AndyShevchenko thank you! This will be a great timesaver for me :-D
– pepoluan
Nov 29 '16 at 3:19
1
I know the OP asked for "drivers being used", but what if the driver is not installed nor being used? How to find out just by thevendorID:productID
? Also, what if it is not a PCI device, and you only see it inlsusb
for example?
– Dr Beco
Jun 26 '17 at 18:48
1
@DrBeco: But if driver is not installed, what do you want to find? You should just google in this case
– Igor Chubin
Jun 27 '17 at 15:18
|
show 2 more comments
Just use /sys
.
Example. I want to find the driver for my Ethernet card:
$ sudo lspci
...
02:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168B PCI Express Gigabit Ethernet controller (rev 01)
$ find /sys | grep drivers.*02:00
/sys/bus/pci/drivers/r8169/0000:02:00.0
That is r8169
.
First I need to find coordinates of the device using lspci
; then I find driver that is used for the devices with these coordinates.
Just use /sys
.
Example. I want to find the driver for my Ethernet card:
$ sudo lspci
...
02:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168B PCI Express Gigabit Ethernet controller (rev 01)
$ find /sys | grep drivers.*02:00
/sys/bus/pci/drivers/r8169/0000:02:00.0
That is r8169
.
First I need to find coordinates of the device using lspci
; then I find driver that is used for the devices with these coordinates.
answered Jun 27 '12 at 9:50
Igor ChubinIgor Chubin
59658
59658
32
lspci -v
does it by itself.
– poige
Jul 1 '12 at 4:50
6
lspci -nk
will show you attached drivers. In general the sysfs is the right place to search for.
– 0andriy
Nov 18 '15 at 20:03
@AndyShevchenko thank you! This will be a great timesaver for me :-D
– pepoluan
Nov 29 '16 at 3:19
1
I know the OP asked for "drivers being used", but what if the driver is not installed nor being used? How to find out just by thevendorID:productID
? Also, what if it is not a PCI device, and you only see it inlsusb
for example?
– Dr Beco
Jun 26 '17 at 18:48
1
@DrBeco: But if driver is not installed, what do you want to find? You should just google in this case
– Igor Chubin
Jun 27 '17 at 15:18
|
show 2 more comments
32
lspci -v
does it by itself.
– poige
Jul 1 '12 at 4:50
6
lspci -nk
will show you attached drivers. In general the sysfs is the right place to search for.
– 0andriy
Nov 18 '15 at 20:03
@AndyShevchenko thank you! This will be a great timesaver for me :-D
– pepoluan
Nov 29 '16 at 3:19
1
I know the OP asked for "drivers being used", but what if the driver is not installed nor being used? How to find out just by thevendorID:productID
? Also, what if it is not a PCI device, and you only see it inlsusb
for example?
– Dr Beco
Jun 26 '17 at 18:48
1
@DrBeco: But if driver is not installed, what do you want to find? You should just google in this case
– Igor Chubin
Jun 27 '17 at 15:18
32
32
lspci -v
does it by itself.– poige
Jul 1 '12 at 4:50
lspci -v
does it by itself.– poige
Jul 1 '12 at 4:50
6
6
lspci -nk
will show you attached drivers. In general the sysfs is the right place to search for.– 0andriy
Nov 18 '15 at 20:03
lspci -nk
will show you attached drivers. In general the sysfs is the right place to search for.– 0andriy
Nov 18 '15 at 20:03
@AndyShevchenko thank you! This will be a great timesaver for me :-D
– pepoluan
Nov 29 '16 at 3:19
@AndyShevchenko thank you! This will be a great timesaver for me :-D
– pepoluan
Nov 29 '16 at 3:19
1
1
I know the OP asked for "drivers being used", but what if the driver is not installed nor being used? How to find out just by the
vendorID:productID
? Also, what if it is not a PCI device, and you only see it in lsusb
for example?– Dr Beco
Jun 26 '17 at 18:48
I know the OP asked for "drivers being used", but what if the driver is not installed nor being used? How to find out just by the
vendorID:productID
? Also, what if it is not a PCI device, and you only see it in lsusb
for example?– Dr Beco
Jun 26 '17 at 18:48
1
1
@DrBeco: But if driver is not installed, what do you want to find? You should just google in this case
– Igor Chubin
Jun 27 '17 at 15:18
@DrBeco: But if driver is not installed, what do you want to find? You should just google in this case
– Igor Chubin
Jun 27 '17 at 15:18
|
show 2 more comments
Here's a little script I wrote:
#!/bin/bash
for f in /sys/class/net/*; do
dev=$(basename $f)
driver=$(readlink $f/device/driver/module)
if [ $driver ]; then
driver=$(basename $driver)
fi
addr=$(cat $f/address)
operstate=$(cat $f/operstate)
printf "%10s [%s]: %10s (%s)n" "$dev" "$addr" "$driver" "$operstate"
done
Sample output:
$ ~/what_eth_drivers.sh
eth0 [52:54:00:aa:bb:cc]: virtio_net (up)
eth1 [52:54:00:dd:ee:ff]: virtio_net (up)
eth2 [52:54:00:99:88:77]: virtio_net (up)
lo [00:00:00:00:00:00]: (unknown)
1
I much prefer reading links to finding/grepping. Nice solution.
– Chris Mendez
Jan 29 '16 at 16:24
Thanks! Way better than the unreliable 'dmesg|grep' (ring buffer...)
– Dominik R
Feb 10 '16 at 15:04
I'd like to find solution which would find alsoveth
and other virtual drivers. IMHO the only solution is to useethtool
orlshw
.
– pevik
Jul 20 '17 at 21:37
add a comment |
Here's a little script I wrote:
#!/bin/bash
for f in /sys/class/net/*; do
dev=$(basename $f)
driver=$(readlink $f/device/driver/module)
if [ $driver ]; then
driver=$(basename $driver)
fi
addr=$(cat $f/address)
operstate=$(cat $f/operstate)
printf "%10s [%s]: %10s (%s)n" "$dev" "$addr" "$driver" "$operstate"
done
Sample output:
$ ~/what_eth_drivers.sh
eth0 [52:54:00:aa:bb:cc]: virtio_net (up)
eth1 [52:54:00:dd:ee:ff]: virtio_net (up)
eth2 [52:54:00:99:88:77]: virtio_net (up)
lo [00:00:00:00:00:00]: (unknown)
1
I much prefer reading links to finding/grepping. Nice solution.
– Chris Mendez
Jan 29 '16 at 16:24
Thanks! Way better than the unreliable 'dmesg|grep' (ring buffer...)
– Dominik R
Feb 10 '16 at 15:04
I'd like to find solution which would find alsoveth
and other virtual drivers. IMHO the only solution is to useethtool
orlshw
.
– pevik
Jul 20 '17 at 21:37
add a comment |
Here's a little script I wrote:
#!/bin/bash
for f in /sys/class/net/*; do
dev=$(basename $f)
driver=$(readlink $f/device/driver/module)
if [ $driver ]; then
driver=$(basename $driver)
fi
addr=$(cat $f/address)
operstate=$(cat $f/operstate)
printf "%10s [%s]: %10s (%s)n" "$dev" "$addr" "$driver" "$operstate"
done
Sample output:
$ ~/what_eth_drivers.sh
eth0 [52:54:00:aa:bb:cc]: virtio_net (up)
eth1 [52:54:00:dd:ee:ff]: virtio_net (up)
eth2 [52:54:00:99:88:77]: virtio_net (up)
lo [00:00:00:00:00:00]: (unknown)
Here's a little script I wrote:
#!/bin/bash
for f in /sys/class/net/*; do
dev=$(basename $f)
driver=$(readlink $f/device/driver/module)
if [ $driver ]; then
driver=$(basename $driver)
fi
addr=$(cat $f/address)
operstate=$(cat $f/operstate)
printf "%10s [%s]: %10s (%s)n" "$dev" "$addr" "$driver" "$operstate"
done
Sample output:
$ ~/what_eth_drivers.sh
eth0 [52:54:00:aa:bb:cc]: virtio_net (up)
eth1 [52:54:00:dd:ee:ff]: virtio_net (up)
eth2 [52:54:00:99:88:77]: virtio_net (up)
lo [00:00:00:00:00:00]: (unknown)
edited Jul 29 '16 at 15:12
answered Aug 25 '15 at 22:53
Jonathon ReinhartJonathon Reinhart
84911018
84911018
1
I much prefer reading links to finding/grepping. Nice solution.
– Chris Mendez
Jan 29 '16 at 16:24
Thanks! Way better than the unreliable 'dmesg|grep' (ring buffer...)
– Dominik R
Feb 10 '16 at 15:04
I'd like to find solution which would find alsoveth
and other virtual drivers. IMHO the only solution is to useethtool
orlshw
.
– pevik
Jul 20 '17 at 21:37
add a comment |
1
I much prefer reading links to finding/grepping. Nice solution.
– Chris Mendez
Jan 29 '16 at 16:24
Thanks! Way better than the unreliable 'dmesg|grep' (ring buffer...)
– Dominik R
Feb 10 '16 at 15:04
I'd like to find solution which would find alsoveth
and other virtual drivers. IMHO the only solution is to useethtool
orlshw
.
– pevik
Jul 20 '17 at 21:37
1
1
I much prefer reading links to finding/grepping. Nice solution.
– Chris Mendez
Jan 29 '16 at 16:24
I much prefer reading links to finding/grepping. Nice solution.
– Chris Mendez
Jan 29 '16 at 16:24
Thanks! Way better than the unreliable 'dmesg|grep' (ring buffer...)
– Dominik R
Feb 10 '16 at 15:04
Thanks! Way better than the unreliable 'dmesg|grep' (ring buffer...)
– Dominik R
Feb 10 '16 at 15:04
I'd like to find solution which would find also
veth
and other virtual drivers. IMHO the only solution is to use ethtool
or lshw
.– pevik
Jul 20 '17 at 21:37
I'd like to find solution which would find also
veth
and other virtual drivers. IMHO the only solution is to use ethtool
or lshw
.– pevik
Jul 20 '17 at 21:37
add a comment |
sudo lspci -v
will show it. like this:
$ sudo lspci -v
00:01.0 VGA compatible controller: Advanced Micro Devices, Inc......
...
Kernel driver in use: radeon
Kernel modules: radeon
You can also combine it with grep
like this:
$ sudo lspci -v | grep -A 20 VGA
add a comment |
sudo lspci -v
will show it. like this:
$ sudo lspci -v
00:01.0 VGA compatible controller: Advanced Micro Devices, Inc......
...
Kernel driver in use: radeon
Kernel modules: radeon
You can also combine it with grep
like this:
$ sudo lspci -v | grep -A 20 VGA
add a comment |
sudo lspci -v
will show it. like this:
$ sudo lspci -v
00:01.0 VGA compatible controller: Advanced Micro Devices, Inc......
...
Kernel driver in use: radeon
Kernel modules: radeon
You can also combine it with grep
like this:
$ sudo lspci -v | grep -A 20 VGA
sudo lspci -v
will show it. like this:
$ sudo lspci -v
00:01.0 VGA compatible controller: Advanced Micro Devices, Inc......
...
Kernel driver in use: radeon
Kernel modules: radeon
You can also combine it with grep
like this:
$ sudo lspci -v | grep -A 20 VGA
edited Oct 19 '17 at 12:35
Jonathon Reinhart
84911018
84911018
answered Jan 10 '17 at 21:31
mlibremlibre
584616
584616
add a comment |
add a comment |
If you just want to plainly use sysfs and doesn't want to deal with all these commands which eventually looks inside sysfs anyways, here's how:
say, what is the module/driver for eth6? "sfc" it is
# ls -l /sys/class/net/eth6/device/driver
lrwxrwxrwx 1 root root 0 Jan 22 12:30 /sys/class/net/eth6/device/driver ->
../../../../bus/pci/drivers/sfc
or better yet.. let readlink resolve the path for you.
# readlink -f /sys/class/net/eth6/device/driver
/sys/bus/pci/drivers/sfc
so... to figure out what are the drivers for all of your network interfaces:
# ls -1 /sys/class/net/ | grep -v lo | xargs -n1 -I bash -c 'echo -n :" " ; basename `readlink -f /sys/class/net//device/driver`'
eth0 : tg3
eth1 : tg3
eth10 : mlx4_core
eth11 : mlx4_core
eth2 : tg3
eth3 : tg3
eth4 : mlx4_core
eth5 : mlx4_core
eth6 : sfc
eth7 : sfc
eth8 : sfc
eth9 : sfc
how is this one better than the one Jonathan Reinhart posted ? unix.stackexchange.com/a/225496/47663
– nhed
Feb 8 '18 at 4:58
Probably same... but I love one liner... I can easily adjust things right at the command line... just for those who don't have time to open a file and write a script.
– Monty Montemayor
Feb 13 '18 at 17:37
add a comment |
If you just want to plainly use sysfs and doesn't want to deal with all these commands which eventually looks inside sysfs anyways, here's how:
say, what is the module/driver for eth6? "sfc" it is
# ls -l /sys/class/net/eth6/device/driver
lrwxrwxrwx 1 root root 0 Jan 22 12:30 /sys/class/net/eth6/device/driver ->
../../../../bus/pci/drivers/sfc
or better yet.. let readlink resolve the path for you.
# readlink -f /sys/class/net/eth6/device/driver
/sys/bus/pci/drivers/sfc
so... to figure out what are the drivers for all of your network interfaces:
# ls -1 /sys/class/net/ | grep -v lo | xargs -n1 -I bash -c 'echo -n :" " ; basename `readlink -f /sys/class/net//device/driver`'
eth0 : tg3
eth1 : tg3
eth10 : mlx4_core
eth11 : mlx4_core
eth2 : tg3
eth3 : tg3
eth4 : mlx4_core
eth5 : mlx4_core
eth6 : sfc
eth7 : sfc
eth8 : sfc
eth9 : sfc
how is this one better than the one Jonathan Reinhart posted ? unix.stackexchange.com/a/225496/47663
– nhed
Feb 8 '18 at 4:58
Probably same... but I love one liner... I can easily adjust things right at the command line... just for those who don't have time to open a file and write a script.
– Monty Montemayor
Feb 13 '18 at 17:37
add a comment |
If you just want to plainly use sysfs and doesn't want to deal with all these commands which eventually looks inside sysfs anyways, here's how:
say, what is the module/driver for eth6? "sfc" it is
# ls -l /sys/class/net/eth6/device/driver
lrwxrwxrwx 1 root root 0 Jan 22 12:30 /sys/class/net/eth6/device/driver ->
../../../../bus/pci/drivers/sfc
or better yet.. let readlink resolve the path for you.
# readlink -f /sys/class/net/eth6/device/driver
/sys/bus/pci/drivers/sfc
so... to figure out what are the drivers for all of your network interfaces:
# ls -1 /sys/class/net/ | grep -v lo | xargs -n1 -I bash -c 'echo -n :" " ; basename `readlink -f /sys/class/net//device/driver`'
eth0 : tg3
eth1 : tg3
eth10 : mlx4_core
eth11 : mlx4_core
eth2 : tg3
eth3 : tg3
eth4 : mlx4_core
eth5 : mlx4_core
eth6 : sfc
eth7 : sfc
eth8 : sfc
eth9 : sfc
If you just want to plainly use sysfs and doesn't want to deal with all these commands which eventually looks inside sysfs anyways, here's how:
say, what is the module/driver for eth6? "sfc" it is
# ls -l /sys/class/net/eth6/device/driver
lrwxrwxrwx 1 root root 0 Jan 22 12:30 /sys/class/net/eth6/device/driver ->
../../../../bus/pci/drivers/sfc
or better yet.. let readlink resolve the path for you.
# readlink -f /sys/class/net/eth6/device/driver
/sys/bus/pci/drivers/sfc
so... to figure out what are the drivers for all of your network interfaces:
# ls -1 /sys/class/net/ | grep -v lo | xargs -n1 -I bash -c 'echo -n :" " ; basename `readlink -f /sys/class/net//device/driver`'
eth0 : tg3
eth1 : tg3
eth10 : mlx4_core
eth11 : mlx4_core
eth2 : tg3
eth3 : tg3
eth4 : mlx4_core
eth5 : mlx4_core
eth6 : sfc
eth7 : sfc
eth8 : sfc
eth9 : sfc
edited 10 hours ago
Rui F Ribeiro
42.1k1484142
42.1k1484142
answered Jan 29 '18 at 20:59
Monty MontemayorMonty Montemayor
413
413
how is this one better than the one Jonathan Reinhart posted ? unix.stackexchange.com/a/225496/47663
– nhed
Feb 8 '18 at 4:58
Probably same... but I love one liner... I can easily adjust things right at the command line... just for those who don't have time to open a file and write a script.
– Monty Montemayor
Feb 13 '18 at 17:37
add a comment |
how is this one better than the one Jonathan Reinhart posted ? unix.stackexchange.com/a/225496/47663
– nhed
Feb 8 '18 at 4:58
Probably same... but I love one liner... I can easily adjust things right at the command line... just for those who don't have time to open a file and write a script.
– Monty Montemayor
Feb 13 '18 at 17:37
how is this one better than the one Jonathan Reinhart posted ? unix.stackexchange.com/a/225496/47663
– nhed
Feb 8 '18 at 4:58
how is this one better than the one Jonathan Reinhart posted ? unix.stackexchange.com/a/225496/47663
– nhed
Feb 8 '18 at 4:58
Probably same... but I love one liner... I can easily adjust things right at the command line... just for those who don't have time to open a file and write a script.
– Monty Montemayor
Feb 13 '18 at 17:37
Probably same... but I love one liner... I can easily adjust things right at the command line... just for those who don't have time to open a file and write a script.
– Monty Montemayor
Feb 13 '18 at 17:37
add a comment |
You can use the lsmod
command to get the status of loaded modules / devices drivers in the Linux Kernel.
For a specific device, you can use dmesg |grep <device-name>
to get the details too.
1
Thanks. But if i loaded two drivers for a device with same major no and different minor no ,and if only one driver is being used for the device ,how can I find which driver is used for that device?
– Deepu
Jun 27 '12 at 6:34
perhaps this SO question can help you further.
– gkris
Jun 27 '12 at 6:49
If your system has not been online so long that the ring buffer has re-started, sure dmesg | grep <device-name> will work ; this doesn't work on any of my routers, however.
– cjac
Mar 7 '16 at 1:47
add a comment |
You can use the lsmod
command to get the status of loaded modules / devices drivers in the Linux Kernel.
For a specific device, you can use dmesg |grep <device-name>
to get the details too.
1
Thanks. But if i loaded two drivers for a device with same major no and different minor no ,and if only one driver is being used for the device ,how can I find which driver is used for that device?
– Deepu
Jun 27 '12 at 6:34
perhaps this SO question can help you further.
– gkris
Jun 27 '12 at 6:49
If your system has not been online so long that the ring buffer has re-started, sure dmesg | grep <device-name> will work ; this doesn't work on any of my routers, however.
– cjac
Mar 7 '16 at 1:47
add a comment |
You can use the lsmod
command to get the status of loaded modules / devices drivers in the Linux Kernel.
For a specific device, you can use dmesg |grep <device-name>
to get the details too.
You can use the lsmod
command to get the status of loaded modules / devices drivers in the Linux Kernel.
For a specific device, you can use dmesg |grep <device-name>
to get the details too.
answered Jun 27 '12 at 6:21
gkris
1
Thanks. But if i loaded two drivers for a device with same major no and different minor no ,and if only one driver is being used for the device ,how can I find which driver is used for that device?
– Deepu
Jun 27 '12 at 6:34
perhaps this SO question can help you further.
– gkris
Jun 27 '12 at 6:49
If your system has not been online so long that the ring buffer has re-started, sure dmesg | grep <device-name> will work ; this doesn't work on any of my routers, however.
– cjac
Mar 7 '16 at 1:47
add a comment |
1
Thanks. But if i loaded two drivers for a device with same major no and different minor no ,and if only one driver is being used for the device ,how can I find which driver is used for that device?
– Deepu
Jun 27 '12 at 6:34
perhaps this SO question can help you further.
– gkris
Jun 27 '12 at 6:49
If your system has not been online so long that the ring buffer has re-started, sure dmesg | grep <device-name> will work ; this doesn't work on any of my routers, however.
– cjac
Mar 7 '16 at 1:47
1
1
Thanks. But if i loaded two drivers for a device with same major no and different minor no ,and if only one driver is being used for the device ,how can I find which driver is used for that device?
– Deepu
Jun 27 '12 at 6:34
Thanks. But if i loaded two drivers for a device with same major no and different minor no ,and if only one driver is being used for the device ,how can I find which driver is used for that device?
– Deepu
Jun 27 '12 at 6:34
perhaps this SO question can help you further.
– gkris
Jun 27 '12 at 6:49
perhaps this SO question can help you further.
– gkris
Jun 27 '12 at 6:49
If your system has not been online so long that the ring buffer has re-started, sure dmesg | grep <device-name> will work ; this doesn't work on any of my routers, however.
– cjac
Mar 7 '16 at 1:47
If your system has not been online so long that the ring buffer has re-started, sure dmesg | grep <device-name> will work ; this doesn't work on any of my routers, however.
– cjac
Mar 7 '16 at 1:47
add a comment |
For USB based devices you can see the driver name by using the lsusb
command:
lsusb -t
And/or you use lshw
which enumerates the devices on all buses including USB, PCI, etc so you can see which driver it uses:
sudo lshw
add a comment |
For USB based devices you can see the driver name by using the lsusb
command:
lsusb -t
And/or you use lshw
which enumerates the devices on all buses including USB, PCI, etc so you can see which driver it uses:
sudo lshw
add a comment |
For USB based devices you can see the driver name by using the lsusb
command:
lsusb -t
And/or you use lshw
which enumerates the devices on all buses including USB, PCI, etc so you can see which driver it uses:
sudo lshw
For USB based devices you can see the driver name by using the lsusb
command:
lsusb -t
And/or you use lshw
which enumerates the devices on all buses including USB, PCI, etc so you can see which driver it uses:
sudo lshw
answered Jan 8 '18 at 19:37
PierzPierz
25127
25127
add a comment |
add a comment |
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f41817%2flinux-how-to-find-the-device-driver-used-for-a-device%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
-linux, linux-kernel