Add .NET 6 to PATH On Linux

This blog post will show you how to add .NET to your Linux PATH and set the OS to use the correct version.

Check .NET SDK Path

To check and find your .NET 6 install run the following command.

dotnet --list-sdks

The output of the command will show you the path as shown below.

6.0.106 [/usr/lib64/dotnet/sdk]

Add to Path

To add the above path to the PATH, I will add the following line to my ~/.bash_profile

export PATH="/usr/lib64/dotnet/sdk:$PATH"

After saving the file, reload the shell using the command below.

source ~/.bash_profile

Success! You're on the list.