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;








55















If my target has one device connected and many drivers for that device loaded, how can I understand what device is using which driver?










share|improve this question















migrated from stackoverflow.com Jun 28 '12 at 8:37


This question came from our site for professional and enthusiast programmers.
























    55















    If my target has one device connected and many drivers for that device loaded, how can I understand what device is using which driver?










    share|improve this question















    migrated from stackoverflow.com Jun 28 '12 at 8:37


    This question came from our site for professional and enthusiast programmers.




















      55












      55








      55


      22






      If my target has one device connected and many drivers for that device loaded, how can I understand what device is using which driver?










      share|improve this question
















      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






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      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.






















          6 Answers
          6






          active

          oldest

          votes


















          40














          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.






          share|improve this answer


















          • 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 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





            @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


















          20














          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)





          share|improve this answer




















          • 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 also veth and other virtual drivers. IMHO the only solution is to use ethtool or lshw.

            – pevik
            Jul 20 '17 at 21:37


















          7














          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





          share|improve this answer
































            4














            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





            share|improve this answer

























            • 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


















            2














            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.






            share|improve this answer


















            • 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














            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





            share|improve this answer























              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
              );



              );













              draft saved

              draft discarded


















              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









              40














              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.






              share|improve this answer


















              • 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 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





                @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















              40














              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.






              share|improve this answer


















              • 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 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





                @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













              40












              40








              40







              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.






              share|improve this answer













              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.







              share|improve this answer












              share|improve this answer



              share|improve this answer










              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 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





                @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





                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 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





                @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













              20














              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)





              share|improve this answer




















              • 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 also veth and other virtual drivers. IMHO the only solution is to use ethtool or lshw.

                – pevik
                Jul 20 '17 at 21:37















              20














              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)





              share|improve this answer




















              • 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 also veth and other virtual drivers. IMHO the only solution is to use ethtool or lshw.

                – pevik
                Jul 20 '17 at 21:37













              20












              20








              20







              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)





              share|improve this answer















              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)






              share|improve this answer














              share|improve this answer



              share|improve this answer








              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 also veth and other virtual drivers. IMHO the only solution is to use ethtool or lshw.

                – pevik
                Jul 20 '17 at 21:37












              • 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 also veth and other virtual drivers. IMHO the only solution is to use ethtool or lshw.

                – 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











              7














              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





              share|improve this answer





























                7














                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





                share|improve this answer



























                  7












                  7








                  7







                  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





                  share|improve this answer















                  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






                  share|improve this answer














                  share|improve this answer



                  share|improve this answer








                  edited Oct 19 '17 at 12:35









                  Jonathon Reinhart

                  84911018




                  84911018










                  answered Jan 10 '17 at 21:31









                  mlibremlibre

                  584616




                  584616





















                      4














                      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





                      share|improve this answer

























                      • 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















                      4














                      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





                      share|improve this answer

























                      • 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













                      4












                      4








                      4







                      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





                      share|improve this answer















                      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






                      share|improve this answer














                      share|improve this answer



                      share|improve this answer








                      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

















                      • 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











                      2














                      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.






                      share|improve this answer


















                      • 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















                      2














                      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.






                      share|improve this answer


















                      • 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













                      2












                      2








                      2







                      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.






                      share|improve this answer













                      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.







                      share|improve this answer












                      share|improve this answer



                      share|improve this answer










                      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












                      • 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











                      1














                      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





                      share|improve this answer



























                        1














                        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





                        share|improve this answer

























                          1












                          1








                          1







                          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





                          share|improve this answer













                          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






                          share|improve this answer












                          share|improve this answer



                          share|improve this answer










                          answered Jan 8 '18 at 19:37









                          PierzPierz

                          25127




                          25127



























                              draft saved

                              draft discarded
















































                              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.




                              draft saved


                              draft discarded














                              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





















































                              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

                              Popular posts from this blog

                              Mobil Contents History Mobil brands Former Mobil brands Lukoil transaction Mobil UK Mobil Australia Mobil New Zealand Mobil Greece Mobil in Japan Mobil in Canada Mobil Egypt See also References External links Navigation menuwww.mobil.com"Mobil Corporation"the original"Our Houston campus""Business & Finance: Socony-Vacuum Corp.""Popular Mechanics""Lubrite Technologies""Exxon Mobil campus 'clearly happening'""Toledo Blade - Google News Archive Search""The Lion and the Moose - How 2 Executives Pulled off the Biggest Merger Ever""ExxonMobil Press Release""Lubricants""Archived copy"the original"Mobil 1™ and Mobil Super™ motor oil and synthetic motor oil - Mobil™ Motor Oils""Mobil Delvac""Mobil Industrial website""The State of Competition in Gasoline Marketing: The Effects of Refiner Operations at Retail""Mobil Travel Guide to become Forbes Travel Guide""Hotel Rankings: Forbes Merges with Mobil"the original"Jamieson oil industry history""Mobil news""Caltex pumps for control""Watchdog blocks Caltex bid""Exxon Mobil sells service station network""Mobil Oil New Zealand Limited is New Zealand's oldest oil company, with predecessor companies having first established a presence in the country in 1896""ExxonMobil subsidiaries have a business history in New Zealand stretching back more than 120 years. We are involved in petroleum refining and distribution and the marketing of fuels, lubricants and chemical products""Archived copy"the original"Exxon Mobil to Sell Its Japanese Arm for $3.9 Billion""Gas station merger will end Esso and Mobil's long run in Japan""Esso moves to affiliate itself with PC Optimum, no longer Aeroplan, in loyalty point switch""Mobil brand of gas stations to launch in Canada after deal for 213 Loblaws-owned locations""Mobil Nears Completion of Rebranding 200 Loblaw Gas Stations""Learn about ExxonMobil's operations in Egypt""Petrol and Diesel Service Stations in Egypt - Mobil"Official websiteExxon Mobil corporate websiteMobil Industrial official websiteeeeeeeeDA04275022275790-40000 0001 0860 5061n82045453134887257134887257

                              Frič See also Navigation menuinternal link

                              Identify plant with long narrow paired leaves and reddish stems Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern) Announcing the arrival of Valued Associate #679: Cesar Manara Unicorn Meta Zoo #1: Why another podcast?What is this plant with long sharp leaves? Is it a weed?What is this 3ft high, stalky plant, with mid sized narrow leaves?What is this young shrub with opposite ovate, crenate leaves and reddish stems?What is this plant with large broad serrated leaves?Identify this upright branching weed with long leaves and reddish stemsPlease help me identify this bulbous plant with long, broad leaves and white flowersWhat is this small annual with narrow gray/green leaves and rust colored daisy-type flowers?What is this chilli plant?Does anyone know what type of chilli plant this is?Help identify this plant