Software & AppsOperating SystemLinux

How To Uninstall a Program Installed by a .sh Installer on Ubuntu

Ubuntu 1

In this guide, we will walk through the steps on how to uninstall a program installed by a .sh installer on Ubuntu. This process can be a bit tricky, especially if the program does not come with an uninstall script. However, with a bit of patience and the right commands, you can successfully remove the program from your system.

Quick Answer

To uninstall a program installed by a .sh installer on Ubuntu, you have a few options. If the program comes with a remove script, you can locate and execute that script to uninstall the program. If there is no remove script, you can manually remove the program by deleting the installation directory and any related files. Additionally, you can use the xdg-desktop-menu command to uninstall the program’s menu entry.

Understanding .sh Installers

Before we begin, it’s important to understand what a .sh installer is. A .sh file is a shell script used by the Unix shell, which is a command-line interpreter. These scripts are used to install programs on Unix-based systems like Ubuntu. The installer script may create directories, copy files, and set up configurations.

Method 1: Using a Remove Script

Step 1: Locate the Remove Script

Many .sh installers also come with a corresponding remove script. This script is typically named uninstall.sh or something similar. You can usually find the location of the remove script in the README file of the application. If not, you will have to search for it in the installation directory, typically located under /usr/local/games/<NAME_OF_GAME>.

Step 2: Execute the Remove Script

To execute the remove script, open a terminal and navigate to the directory where the script is located. You can do this by using the cd command, which stands for “change directory”. For example:

cd /usr/local/games/<NAME_OF_GAME>

Once you’re in the correct directory, run the following command to execute the remove script:

./<NAME_OF_SCRIPT>.sh

Method 2: Manual Removal

If the application does not have an uninstaller script, you can remove it manually. This process involves deleting the installation directory and any related files.

Step 1: Delete the Installation Directory

The first step is to delete the complete directory where the game is installed. This is typically located under /usr/local/games/<NAME_OF_GAME>. To delete this directory, use the rm command, which stands for “remove”. For example:

rm -r /usr/local/games/<NAME_OF_GAME>

The -r option tells rm to remove directories and their contents recursively.

Step 2: Remove Related Files

In addition to the installation directory, you may need to remove any related files or directories in other locations. To find all the directories that the installer script has changed, you can use the grep command. This command searches for a pattern in a file. For example:

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

Replace script.sh with the name of the .sh file. This command will print all paths found in the install script. Review the output and delete any relevant directories or files.

Method 3: Using xdg-desktop-menu

In some cases, you may be able to use the xdg-desktop-menu command to uninstall the program’s menu entry. However, this command only removes the menu entry and not the complete program itself. To use xdg-desktop-menu, you would need to provide the directory-file(s) or desktop-file(s) associated with the program. For example:

xdg-desktop-menu uninstall /usr/local/games/<NAME_OF_GAME>

Conclusion

Uninstalling a program installed by a .sh installer on Ubuntu can be a bit tricky, but it’s definitely doable. Whether you’re using a remove script, removing the program manually, or using xdg-desktop-menu, you now have the knowledge to uninstall these programs from your system.

Remember to always be careful when deleting files and directories. If you’re unsure about a command or a step in the process, don’t hesitate to consult the Ubuntu community or the program’s documentation for help.

What should I do if the .sh installer does not come with an uninstall script?

If the .sh installer does not come with an uninstall script, you can manually remove the program by deleting the installation directory and any related files. Refer to Method 2 in the guide for detailed instructions.

How can I find the location of the remove script?

The location of the remove script is usually mentioned in the README file of the application. If not, you can search for it in the installation directory, typically located under /usr/local/games/<NAME_OF_GAME>.

Leave a Comment

Your email address will not be published. Required fields are marked *