After several search I got an article then that one didn't even work for me so decide to check out Microsoft Documents for this issue. then found one , here is the solution.
Bash cmd - To check if .Net framework is installed :-
dotnet --list-runtimes
Then to uninstall it :-
sudo apt-get remove dotnet-host
if you are the root-user then it will work without sudo just apt-get remove dotnet-host then the required password.
This is how it should look while you run it in Ubuntu system.
user@user1:~$ dotnet --list-runtimes
Microsoft.AspNetCore.App 6.0.7 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 6.0.7 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
user@user1:~$ sudo apt-get remove dotnet-host
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
aspnetcore-targeting-pack-6.0 dotnet-apphost-pack-6.0 dotnet-runtime-deps-6.0
dotnet-targeting-pack-6.0 netstandard-targeting-pack-2.1
Use 'sudo apt autoremove' to remove them.
The following packages will be REMOVED:
aspnetcore-runtime-6.0 dotnet-host dotnet-hostfxr-6.0 dotnet-runtime-6.0
dotnet-sdk-6.0
0 upgraded, 0 newly installed, 5 to remove and 0 not upgraded.
After this operation, 430 MB disk space will be freed.
Do you want to continue? [Y/n] Y
(Reading database ... 203619 files and directories currently installed.)
Removing dotnet-sdk-6.0 (6.0.302-1) ...
Removing aspnetcore-runtime-6.0 (6.0.7-1) ...
Removing dotnet-runtime-6.0 (6.0.7-1) ...
Removing dotnet-hostfxr-6.0 (6.0.7-1) ...
Removing dotnet-host (6.0.7-1) ...
Processing triggers for man-db (2.9.1-1) ...
user@user1:~$ dotnet --list-runtimes
bash: /usr/bin/dotnet: No such file or directory
Refer to check if .net exists in your Ubuntu system :- docs.microsoft.com/en-us/dotnet/core/instal..
Refer to uninstall .net if found :- docs.microsoft.com/en-us/dotnet/core/instal..