20

I have installed dotnet on my Ubuntu 20.10 but for some reason I want to remove it but I don't know how to do it please help.

enter image description here

Gaurav
  • 301

6 Answers6

19

Try with major and minor version only:

sudo apt remove --purge dotnet-sdk-6.0
sudo apt remove --purge dotnet-runtime-6.0
11

Run these commands:

sudo apt remove --purge dotnet-sdk-5.0.101
sudo apt remove --purge dotnet-runtime-5.0.101
Edmund
  • 747
7

For the situation where dotnet has been installed using snap, you can do the following:

  1. You need to list the names of the snap packages by going to the /snap directory. For example, on Ubuntu 21, my dotnet installations are shown in the following script.

    $ cd /snap
    $ ls
    ...
    dotnet-sdk
    dotnet-runtime-60
    ...
    
  2. Then you can use the following commands to remove the snaps.

    sudo snap remove dotnet-sdk
    sudo snap remove dotnet-runtime-60
    

This was based on the answer for snap packages here: How to list files installed by a snap package?

bkudrle
  • 71
  • 1
  • 3
1

All you have to do is just put the major version number, for example 3.1 or 5.0. You don't have to put any other minor version number/reference number just major version number will do.

For example for lets say your donet-sdk version is 3.1.416 then just right

sudo apt remove --purge dotnet-sdk-3.1
sudo apt remove --purge dotnet-runtime-3.1
1

All you have to do is run this to remove all

sudo apt-get purge dotnet-sdk-*
sudo apt-get purge dotnet-runtime-*

or use version

sudo apt remove --purge dotnet-sdk-6.0
sudo apt remove --purge dotnet-runtime-6.0
Imad
  • 11
-1

You can also use Synaptic to manage all installed versions.

sudo apt install synaptic