Linux command to tell if the machine is physical or virtual












9















How can we check whether the machine is a physical or virtual one in Linux?



Which command can be used?










share|improve this question




















  • 1





    Was there a reason you tagged this question redhat-enterprise-linux? Or is the linux tag more appropriate? Please edit your tags as necessary.

    – Twisty Impersonator
    Aug 7 '17 at 23:50
















9















How can we check whether the machine is a physical or virtual one in Linux?



Which command can be used?










share|improve this question




















  • 1





    Was there a reason you tagged this question redhat-enterprise-linux? Or is the linux tag more appropriate? Please edit your tags as necessary.

    – Twisty Impersonator
    Aug 7 '17 at 23:50














9












9








9


2






How can we check whether the machine is a physical or virtual one in Linux?



Which command can be used?










share|improve this question
















How can we check whether the machine is a physical or virtual one in Linux?



Which command can be used?







linux virtual-machine physical-environment






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Aug 11 '17 at 4:42







Prashast

















asked Aug 7 '17 at 23:37









PrashastPrashast

1118




1118








  • 1





    Was there a reason you tagged this question redhat-enterprise-linux? Or is the linux tag more appropriate? Please edit your tags as necessary.

    – Twisty Impersonator
    Aug 7 '17 at 23:50














  • 1





    Was there a reason you tagged this question redhat-enterprise-linux? Or is the linux tag more appropriate? Please edit your tags as necessary.

    – Twisty Impersonator
    Aug 7 '17 at 23:50








1




1





Was there a reason you tagged this question redhat-enterprise-linux? Or is the linux tag more appropriate? Please edit your tags as necessary.

– Twisty Impersonator
Aug 7 '17 at 23:50





Was there a reason you tagged this question redhat-enterprise-linux? Or is the linux tag more appropriate? Please edit your tags as necessary.

– Twisty Impersonator
Aug 7 '17 at 23:50










3 Answers
3






active

oldest

votes


















7














If you've got systemd installed, it comes with systemd-detect-virt.



me@real-machine:~$ systemd-detect-virt 
none

me@vm:~$ systemd-detect-virt
qemu


Can detect many different types of virtualization and containers, too.



If don't have systemd, there is also virt-what which has a package at least on Debian (and considering where it comes from, unsurprisingly for RedHat too).



See also “Easy way to determine virtualization technology” on Unix & Linux for a bunch more approaches.






share|improve this answer































    10














    Using lshw will give you system information:




    1. Run the command: sudo apt-get install lshw


      • NOTE: This command may vary depending on the Linux distribution.



    2. Run the command: sudo lshw -class system

    3. This will show information about the system. For example, if the machine is a Dell or HP, that will be the product. In the case of a virtual machine, the product will be the name of the emulator.






    share|improve this answer



















    • 4





      You can also do something equivalent with dmidecode

      – davidgo
      Aug 7 '17 at 23:48



















    0














    Similar question in serverfault:



    VMware Linux Server — how can you tell if you are a vm or real hardware?



    And my answer :-)



    hostnamectl status






    share|improve this answer























      Your Answer








      StackExchange.ready(function() {
      var channelOptions = {
      tags: "".split(" "),
      id: "3"
      };
      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: true,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: 10,
      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%2fsuperuser.com%2fquestions%2f1238618%2flinux-command-to-tell-if-the-machine-is-physical-or-virtual%23new-answer', 'question_page');
      }
      );

      Post as a guest















      Required, but never shown

























      3 Answers
      3






      active

      oldest

      votes








      3 Answers
      3






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      7














      If you've got systemd installed, it comes with systemd-detect-virt.



      me@real-machine:~$ systemd-detect-virt 
      none

      me@vm:~$ systemd-detect-virt
      qemu


      Can detect many different types of virtualization and containers, too.



      If don't have systemd, there is also virt-what which has a package at least on Debian (and considering where it comes from, unsurprisingly for RedHat too).



      See also “Easy way to determine virtualization technology” on Unix & Linux for a bunch more approaches.






      share|improve this answer




























        7














        If you've got systemd installed, it comes with systemd-detect-virt.



        me@real-machine:~$ systemd-detect-virt 
        none

        me@vm:~$ systemd-detect-virt
        qemu


        Can detect many different types of virtualization and containers, too.



        If don't have systemd, there is also virt-what which has a package at least on Debian (and considering where it comes from, unsurprisingly for RedHat too).



        See also “Easy way to determine virtualization technology” on Unix & Linux for a bunch more approaches.






        share|improve this answer


























          7












          7








          7







          If you've got systemd installed, it comes with systemd-detect-virt.



          me@real-machine:~$ systemd-detect-virt 
          none

          me@vm:~$ systemd-detect-virt
          qemu


          Can detect many different types of virtualization and containers, too.



          If don't have systemd, there is also virt-what which has a package at least on Debian (and considering where it comes from, unsurprisingly for RedHat too).



          See also “Easy way to determine virtualization technology” on Unix & Linux for a bunch more approaches.






          share|improve this answer













          If you've got systemd installed, it comes with systemd-detect-virt.



          me@real-machine:~$ systemd-detect-virt 
          none

          me@vm:~$ systemd-detect-virt
          qemu


          Can detect many different types of virtualization and containers, too.



          If don't have systemd, there is also virt-what which has a package at least on Debian (and considering where it comes from, unsurprisingly for RedHat too).



          See also “Easy way to determine virtualization technology” on Unix & Linux for a bunch more approaches.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Aug 9 '17 at 19:21









          derobertderobert

          3,0361718




          3,0361718

























              10














              Using lshw will give you system information:




              1. Run the command: sudo apt-get install lshw


                • NOTE: This command may vary depending on the Linux distribution.



              2. Run the command: sudo lshw -class system

              3. This will show information about the system. For example, if the machine is a Dell or HP, that will be the product. In the case of a virtual machine, the product will be the name of the emulator.






              share|improve this answer



















              • 4





                You can also do something equivalent with dmidecode

                – davidgo
                Aug 7 '17 at 23:48
















              10














              Using lshw will give you system information:




              1. Run the command: sudo apt-get install lshw


                • NOTE: This command may vary depending on the Linux distribution.



              2. Run the command: sudo lshw -class system

              3. This will show information about the system. For example, if the machine is a Dell or HP, that will be the product. In the case of a virtual machine, the product will be the name of the emulator.






              share|improve this answer



















              • 4





                You can also do something equivalent with dmidecode

                – davidgo
                Aug 7 '17 at 23:48














              10












              10








              10







              Using lshw will give you system information:




              1. Run the command: sudo apt-get install lshw


                • NOTE: This command may vary depending on the Linux distribution.



              2. Run the command: sudo lshw -class system

              3. This will show information about the system. For example, if the machine is a Dell or HP, that will be the product. In the case of a virtual machine, the product will be the name of the emulator.






              share|improve this answer













              Using lshw will give you system information:




              1. Run the command: sudo apt-get install lshw


                • NOTE: This command may vary depending on the Linux distribution.



              2. Run the command: sudo lshw -class system

              3. This will show information about the system. For example, if the machine is a Dell or HP, that will be the product. In the case of a virtual machine, the product will be the name of the emulator.







              share|improve this answer












              share|improve this answer



              share|improve this answer










              answered Aug 7 '17 at 23:42









              AshtonAshton

              695417




              695417








              • 4





                You can also do something equivalent with dmidecode

                – davidgo
                Aug 7 '17 at 23:48














              • 4





                You can also do something equivalent with dmidecode

                – davidgo
                Aug 7 '17 at 23:48








              4




              4





              You can also do something equivalent with dmidecode

              – davidgo
              Aug 7 '17 at 23:48





              You can also do something equivalent with dmidecode

              – davidgo
              Aug 7 '17 at 23:48











              0














              Similar question in serverfault:



              VMware Linux Server — how can you tell if you are a vm or real hardware?



              And my answer :-)



              hostnamectl status






              share|improve this answer




























                0














                Similar question in serverfault:



                VMware Linux Server — how can you tell if you are a vm or real hardware?



                And my answer :-)



                hostnamectl status






                share|improve this answer


























                  0












                  0








                  0







                  Similar question in serverfault:



                  VMware Linux Server — how can you tell if you are a vm or real hardware?



                  And my answer :-)



                  hostnamectl status






                  share|improve this answer













                  Similar question in serverfault:



                  VMware Linux Server — how can you tell if you are a vm or real hardware?



                  And my answer :-)



                  hostnamectl status







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Jan 18 at 8:49









                  Seweryn Habdank-WojewódzkiSeweryn Habdank-Wojewódzki

                  1214




                  1214






























                      draft saved

                      draft discarded




















































                      Thanks for contributing an answer to Super User!


                      • 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%2fsuperuser.com%2fquestions%2f1238618%2flinux-command-to-tell-if-the-machine-is-physical-or-virtual%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







                      Popular posts from this blog

                      Probability when a professor distributes a quiz and homework assignment to a class of n students.

                      Aardman Animations

                      Are they similar matrix