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.
6 Answers
Try with major and minor version only:
sudo apt remove --purge dotnet-sdk-6.0
sudo apt remove --purge dotnet-runtime-6.0
- 16,703
- 301
Run these commands:
sudo apt remove --purge dotnet-sdk-5.0.101
sudo apt remove --purge dotnet-runtime-5.0.101
- 16,703
- 747
For the situation where dotnet has been installed using snap, you can do the following:
You need to list the names of the snap packages by going to the
/snapdirectory. For example, on Ubuntu 21, mydotnetinstallations are shown in the following script.$ cd /snap $ ls ... dotnet-sdk dotnet-runtime-60 ...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?
- 16,703
- 71
- 1
- 3
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
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
- 11
You can also use Synaptic to manage all installed versions.
sudo apt install synaptic
