1

Look as a preface, I'm new to Linux OS. I've been using ubuntu for a few months and when I first started out I installed vscode. I did this with the windows installer. Wrong but I didn't know at the time. I later installed it using a package manager apt. At this point I had 2 vscode applications on my ubuntu 22.04.3 machine. I used sudo apt-get --purge remove vscode and it got rid of the correctly installed, Linux version but the windows install remains. I've tried to delete it through the GUI by going to applications > vscode > open in software and uninstalling but it persists.

I don't even know where to find the executable for this program. Really any help is appreciated.

3
  • If you're still running Ubuntu 22.04.3 as stated, please apply all security fixes asap as your details show you behind on applying them. You can refer to this page (fridge.ubuntu.com/2024/02/22/ubuntu-22-04-4-lts-released) which shows the ISO releases date of 22.04.4, but installed 22.04 systems upgraded before that date to 22.04.4.
    – guiverc
    Commented May 14 at 11:42
  • Was it perhaps installed as a snap? try snap list Commented May 14 at 13:16
  • Your primary options are to work out what type of package it was, as you need to reverse how it was installed. Was it snap? deb? appimage? flatpak? from source? etc... Usual whereis type commands can give clues; then you know reversal command.. ie. snap remove if snap, dpkg or apt remove if deb etc... Or ask whomever installed it as to how it was installed & thus remove it based on that detail.
    – guiverc
    Commented May 14 at 22:51

1 Answer 1

2

General principle

If you use a third party installation program to install an application, then the only way to remove that application automatically would be through an uninstall option supplied by the same developer/vendor/company.

Best way to remove the third party application

Search the documentation of VSCode to find if there is a way to automatically remove the application. Use the recommended procedure.

Manual way

If there is not, then it is still possible to at least remove some system files so that it is not anymore recognized as an application, although you may not be able to remove every file the application have installed. That will be easiest if you first remove the version installed using apt. You can easily install that back again after you removed the third-party installed version.

  1. Find information about the installed program

    1. Find the desktop launcher

      1. Note the name of the application

        Open the Application Overview (which appears when you click "Show Apps" on the panel), and note the name of the application, e.g. "Visual Studio".

      2. Search the .desktop launcher

        The desktop launcher is the file that provides the icons in the Applications Overview. It provides information about the application to the desktop (and to you).

        You will need to execute a find command in the terminal like this:

        find / -name '*.desktop' -exec grep -H "Name=Visual Studio" {} \;

        (Case and exact spelling are important)

      3. Find the location of the launcher file

        The find command should list a .desktop file that contains the string you searched. The output looks like (this is just a hypothetical example, your output will be different)

        /usr/local/share/applications/microsoft.vscode.desktop:Name=Visual Studio

        Here, /usr/local/share/applications/microsoft.vscode.desktop is the path, anything after the colon, i.e., Name=Visual Studio, is the matching line in the file.

      4. Find the location of the executable

        To find the full file path of the executable, look at the line Exec= of the .desktop launcher file. It could look like (again hypothetical) Exec=/usr/local/bin/vscode. An easy and safe way to see that information in the terminal is:

        cat /usr/local/share/applications/microsoft.vscode.desktop | grep "Exec="

    1. Try finding more information

      See if you can find more information about the executable

      1. whereis vscode will show places where files were installed with the name vscode

      2. file /usr/local/bin/vscode will show the type of file. If it is a script, you could open the script to see which executables it calls.

    2. Clean up as far as possible

      1. Remove the .desktop launcher

        Removing the .desktop launcher already will remove the application from your Application overview. This is a system file, so you must be administrator to remove the file. The easiest way is with the terminal command (adjust based on the information you found).

        sudo rm /usr/local/share/applications/microsoft.vscode.desktop

        ⚠️ Be extremely careful: enter the paths exactly (copy/paster rather than type). Insert an erroneous space after / and your entire file system will be erased!!.

      2. Remove the executable, and any files you may have found in the which command above.

        There is a good chance that files are installed under a directory in /opt. This is a commonly, but not always, adopted convention for third party installed programs. If that is the case, it will be safe to remove the entire directory of that program under /opt:

        sudo /opt/vscode

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .