Score:5

How to find out name of applications to remove it in termial

gh flag

I have tried to uninstall many apps in terminal because some apps are not shown in Ubuntu Software app. Every time, to uninstall an app I have to search from internet because it's hard to know how to write the name of an app in the terminal. For example, FreeOffice's name in terminal is sofmaker-freeoffice-2023, and it is different for other apps.

Is there any way to know in terminal name of applications without searching from the internet?

Score:4
cn flag

This answers the specific question "Is there any way to know in terminal name of applications without searching from the internet?" and "How to find out name of applications to remove it in termial". If you want to use that information to also remove it using the terminal, knowing the name of the executable that launches the program may not be enough.

For applications that are in your menu system, searching your system's .desktop launchers is a good way. .desktop launchers are little text files with the .desktop extension, which are used to tell the operating system various things about an installed application.

You can find such launcher based on what is displayed in the menu. For example, the launcher for LO Writer will contain the string on a line starting with Name=. When you open that launcher in a text editor, you will see the executable specified after Exec=.

You can use any tool you want to search a file based on content, however, I have a little script, which I've named whichdesktop, that searches .desktop files:

Content of whichdesktop:

#!/bin/bash
IFS=$" :"
DIR="$HOME/.local/share/applications"
for d in $XDG_DATA_DIRS; do
    d=$(echo "$d" | sed -e 's/\/$//')
    [ -d $d/applications ] && DIR="$DIR $d/applications"
done
find -L $DIR -name '*.desktop' -exec grep -H "$1" {} \;

It makes a list of the directories where .desktop launchers may be installed, and then invokes find to search only these directories.

For example, if I'm interested in finding what the executable for LibreOffice Writer is called, I run:

$ whichdesktop "LibreOffice Writer"
/usr/share/applications/libreoffice-writer.desktop:Name=LibreOffice Writer
$ cat /usr/share/applications/libreoffice-writer.desktop | grep Exec=
Exec=libreoffice --writer %U
Exec=libreoffice --writer

which tells that the executable is called libreoffice.

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.