How to unistall a program installed by a .sh installer?

45,556

Solution 1

How do I uninstall?

The .sh file is an installer script. It does various actions to install the game. (like copying files to the /usr/local/games/)

Remove using an remove script (recommended)

Most applications that ship with a .sh installer also have a .sh remove script. Sometimes you can find the location of the remove script in the README of the application. Otherwise, you will have to search it yourself in the installation directory (/usr/local/games/<NAME_OF_GAME>). It's named uninstall.sh or something similar.

If you find the script, you can excecute it by typing ./<NAME_OF_SCRIPT>.sh in the terminal.

Remove manually

If the application does not have an uninstaller script, you can remove the application manually by removing the complete directory /usr/local/games/<NAME_OF_GAME> and removing the launcher. However, it could be that the application also has some files in other directories.

You can use the command in Terdon's answer to find all the directories that the installer script changes.

Can i uninstall using xdg-desktop-menu?

No. From the man-pages (man xdg-desktop-menu)

The xdg-desktop-menu program can be used to install new menu entries to the desktop's application menu.

So it is only used to install/remove the menu entry, not the complete program itself

Solution 2

You can't do this automatically, you will have to read the script to see what directories and files it created. You could make that easier with something like:

grep -P '("|/)\S+/\S+' script.sh

The command above should print all paths found in the install script, assuming they don't contain spaces. You can then have a look at the result and delete them by hand.

Share:
45,556

Related videos on Youtube

Istall
Author by

Istall

Updated on September 18, 2022

Comments

  • Istall
    Istall almost 2 years

    I downloaded a .sh program (in this case is a game) and then I installed using "sh name.sh" (or maybe it was "bash name.sh". I don't remember quite well, but I guess it has no importance in this case :P).

    Everything worked as planned. The .sh created a folder in /usr/local/games/ and from there I can run the game from a .bin (I created a "link to application" in my Desktop to run it faster).

    So far so good, but now I want to remove/uninstall the game but I don't know how (I guess that neither apt-get or dpkg work in this particular case. Correct me if I'm wrong).

    So my question is, how can I remove/unistall this game?

    Tyvm in advance for any reply.

    EDIT

    I tried to open and read the .sh (actually, it was the first thing I did), but when I open it, the editor (kate in this case) warns me with the following message:

    The file /home/user/Games/name/name.sh was opened with UTF-8 encoding but contained invalid characters. It is set to read-only mode, as saving might destroy its content. Either reopen the file with the correct encoding chosen or enable the read-write mode again in the menu to be able to edit it.

    And when I try to do anything, such as find or select something, my computer gets numb and 'overloaded' and it doesn't let me do anything (almost as a freeze), and since the code is big I can't just read line by line until I find the part(s) I'm looking for.

    The folder that was created when installed (in /usr/local/games/) has the following:

    name.bin.x86_64
    name.png
    README.linux
    xdg-utils (folder)
      xdg-desktop-menu
    name.dat
    lib64 (folder)
      libfreeimage.so.3
      libminizip.so.1
      libSDL2-2.0.so.0
    xdg-open
    

    I guess that xdg-desktop-menu is used in this case to uninstall the game since when I type in the terminal: "xdg-desktop-menu --help", one of the lines says:

    xdg-desktop-menu uninstall [--noupdate] [--mode mode] directory-file(s)
    desktop-file(s)
    

    But I'm not sure how to use it. Have someone used something like this? or based in the line above, in this case, what should I type?

    • g_p
      g_p over 10 years
      It might have created any script to uninstall the program in the created directory. Search it and run it.
    • MrVaykadji
      MrVaykadji over 10 years
      The best would be to provide a link to the script so we can read it and see if there's an uninstallation line inside it;
    • Ahmadgeo
      Ahmadgeo over 10 years
      You need to open the .sh file (script) and review all of its actions and reverse them. - Create file/folder > Delete it - Installs a package > remove the package .....etc
    • Merlijn Sebrechts
      Merlijn Sebrechts over 10 years
      Is there any helpful information in README.linux ?
  • Istall
    Istall over 10 years
    When I use Terdon's answer, it only displays the message: "Binary file <name>.sh matches", and nothing more. It shows me no paths at all.
  • Istall
    Istall over 10 years
    I guess I could just delete the created folder as well as delete all folders related I know so far, but in the case I do that and some folders still remain after that, is there a way to remove them afterward?
  • Merlijn Sebrechts
    Merlijn Sebrechts over 10 years
    If you find some other directories afterwards, you can still remove them. If you do not have the permission to delete the directory you can start nautilus(files) as root with "sudo nautilus"
  • Merlijn Sebrechts
    Merlijn Sebrechts over 10 years
    This doesn't work on scripts that contain binary archives (like most .sh installers do)
  • terdon
    terdon over 10 years
    @Galgalesh no, of course not but it is the best I can do without access to the script itself. And most .sh installers do not contain binary archives, very few do. In most cases, you will have a configure script and that has no binary data.
  • Merlijn Sebrechts
    Merlijn Sebrechts over 10 years
    Is it not possible to first cut the binary tail before grepping? Isn't there a standard character sequence in front of the binary part? Just out of curiosity, what do you mean with the configure script? Are you talking about the configure script used during make install?
  • Merlijn Sebrechts
    Merlijn Sebrechts over 10 years
    When I read ".sh installer/.sh program" think about a single-file .sh installer, which needs the binary part to store its data...
  • Franva
    Franva over 4 years
    hi help guys, could you please help to remove this one: github.com/jjhelmus/berryconda
  • Franva
    Franva over 4 years
    hi guys, could you please help to remove Berry Conda: github.com/jjhelmus/berryconda