Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I downloaded a .sh program (in this case is a game) and then I installed using "sh" (or maybe it was "bash". 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.


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/ 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:

xdg-utils (folder)
lib64 (folder)

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)

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?

share|improve this question
It might have created any script to uninstall the program in the created directory. Search it and run it. – g_p Mar 9 '14 at 15:32
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; – MrVaykadji Mar 9 '14 at 15:33
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 – Ahmadgeo Mar 9 '14 at 15:42
Is there any helpful information in README.linux ? – Galgalesh Mar 9 '14 at 16:16
@Galgalesh Nope, the only useful info is that it says where my saved games and configurations are located, but when I go there, it's just that, nothing about uninstalling. – Istall Mar 9 '14 at 17:05

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+'

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|improve this answer
This doesn't work on scripts that contain binary archives (like most .sh installers do) – Galgalesh Mar 10 '14 at 15:12
@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. – terdon Mar 10 '14 at 15:16
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? – Galgalesh Mar 10 '14 at 15:25
@Galgalesh don't know about the binary part and yes, I was thinking of the configure script that sets up a system for a make install call, that will normally have all target paths listed as plain text. – terdon Mar 10 '14 at 15:29
When I read ".sh installer/.sh program" think about a single-file .sh installer, which needs the binary part to store its data... – Galgalesh Mar 10 '14 at 15:38

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 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

share|improve this answer
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 Mar 9 '14 at 17:07
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? – Istall Mar 9 '14 at 17:35
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" – Galgalesh Mar 10 '14 at 15:01

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.