How to remove previous versions of .NET Core from Linux (CentOS 7.1)

In CentOS you would do the following:

1 - Find the package installed

yum list installed | grep "aspnet"

2 - Remove the package

yum remove aspnetcore-store-2.0.0.x86_64

On Ubuntu:

First list the dotnet packages installed:

$ sudo apt --installed list | grep "dotnet"

You'll have a result like this:

dotnet-apphost-pack-3.0    dotnet-hostfxr-3.1         dotnet-runtime-deps-5.0
dotnet-apphost-pack-3.1    dotnet-hostfxr-5.0         dotnet-sdk-5.0
dotnet-apphost-pack-5.0    dotnet-runtime-5.0         dotnet-targeting-pack-3.0
dotnet-host                dotnet-runtime-deps-2.2    dotnet-targeting-pack-3.1
dotnet-hostfxr-2.2         dotnet-runtime-deps-3.0    dotnet-targeting-pack-5.0
dotnet-hostfxr-3.0         dotnet-runtime-deps-3.1 

To uninstall the packages of linked to version 3 for example just type:

$ sudo apt-get remove --purge dotnet-*3*

You need to do this over the package manager, otherwise, you end up with a broken system.

This is for Ubuntu/Debian/Mint:

To list all installed packages

sudo apt --installed list

To list all the packages you installed

sudo apt --installed list | grep "dotnet-dev"

to remove a specific package

sudo apt-get remove --purge PACKAGE_NAME 

e.g.

sudo apt-get remove --purge dotnet-dev-1.0.1

For other distros, consult the Packman-Rosetta-Stone