How to get Linux OS name using c#.net core

Prabs 1 Reputation point
2021-04-05T09:03:47.843+00:00

How to get Linux OS name using c#.net core?
I used on windows below code, but i need on linux

string windowsName = RegistryHelper.ReadRegistry(Registry.LocalMachine, @"SOFTWARE\Microsoft\Windows NT\CurrentVersion", "ProductName").ToString();

C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,306 questions
.NET Runtime
.NET Runtime
.NET: Microsoft Technologies based on the .NET software framework.Runtime: An environment required to run apps that aren't compiled to machine language.
1,126 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Timon Yang-MSFT 9,576 Reputation points
    2021-04-06T05:23:41.243+00:00

    You can try to use Process and pass the appropriate Linux commands like the method in the link below.

    Finding available space for a directory in C# on Linux

    I don't have a Linux environment so I haven't tested it. You can try it.


    If the response is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.