How to uninstall dotnet from Ubuntu 20.10 completely?

14,629

Solution 1

Run these commands:

sudo apt remove --purge dotnet-sdk-5.0.101
sudo apt remove --purge dotnet-runtime-5.0.101

Solution 2

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?

Solution 3

Try with major and minor version only:

sudo apt remove --purge dotnet-sdk-6.0
sudo apt remove --purge dotnet-runtime-6.0
Share:
14,629

Related videos on Youtube

Gaurav
Author by

Gaurav

Updated on September 18, 2022

Comments

  • Gaurav
    Gaurav almost 2 years

    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

  • madan
    madan over 2 years
    not working for me sudo dotnet --list-sdks 6.0.101 [/snap/dotnet-sdk/152/sdk] sudo apt remove --purge dotnet-sdk-6.0.101 Reading package lists... Done Building dependency tree Reading state information... Done E: Unable to locate package dotnet-sdk-6.0.101 E: Couldn't find any package by glob 'dotnet-sdk-6.0.101'
  • ChanganAuto
    ChanganAuto over 2 years
    FYI askubuntu.com/a/1388621/1210606 is the correct answer because this comment from am year ago askubuntu.com/questions/1305271/… showed it was a snap.
  • kol
    kol over 2 years
    This worked for me! sudo apt purge dotnet-sdk-6.0
  • kol
    kol over 2 years
    @madan Try with "major.minor", like sudo apt purge dotnet-sdk-6.0
  • madan
    madan over 2 years
    thanks kol, i am afraid i do not currently have this issue so can't try the solution