Einführung
Stellen Sie sich vor, dass sich in Ihrem Ubuntu-Menü Anwendungssymbole angezeigt haben, die Sie möchten:
- Mit der Anwendung vollständig entfernen – hier separat betrachtet.
- Nur das Symbol entfernen – hier betrachtet.
In diesem Beispiel möchte ich das Telegram- oder Telegram Desktop-Symbol entfernen, ohne die Anwendung selbst zu berühren.
Installationsmethoden
Sie erinnern sich nicht, wie Sie die Installation durchgeführt haben. Dies kann einer der folgenden Wege sein:
| Nr. | Installationsmethode | Wie erkennen | Wie entfernen (Terminal) | Besonderheiten / Risiken |
|---|---|---|---|---|
| 1 | Integrierter Repository | apt policy <Name> → archive.ubuntu.com |
sudo apt remove --purge <Name> && sudo apt autoremove |
Sicher, aber autoremove kann andere Pakete betreffen – prüfen Sie. |
| 2 | Hinzugefügter Repository (PPA usw.) | apt policy <Name> → externer URLDatei in /etc/apt/sources.list.d/ |
1. sudo apt remove <Name>2. .list-Datei und Schlüssel löschen3. sudo apt update |
Löschen Sie das Paket vor dem Repository – andernfalls Fehler bei apt. |
| 3 | .deb-Paket |
`dpkg -l | grep ` | sudo apt remove --purge <Name> (besser als dpkg -P) |
| 4 | Snap | `snap list | grep <br>which →/snap/bin/` |
sudo snap remove <Name> |
| 5 | Flatpak | `flatpak list | grep ` | flatpak uninstall <Name> && flatpak remove --unused |
| 6 | Bereitgestellter Binär-Code (AppImage, .tar.gz) |
Nicht in apt/dpkg/snapBinärdatei in ~/Apps/, /opt/, ~/.local/bin/ |
rm -rf /Pfad/zur/Programm ~/.local/share/applications/<Name>.desktop ~/.config/<Name>/ |
Keine zentrale Verwaltung – leicht „vergessen“ zu werden. |
| 7 | .run-Installer |
Wurde mit sudo ./<Name>.run ausgeführtEs gibt /opt/<Name>/, uninstall.sh |
1. sudo /opt/<Name>/uninstall.sh2. Andernfalls manuell – /opt/, /usr/bin/, .desktop, systemd, ~/.config/ |
Der „größte“ Schmutzweg. Häufig bleibt kein uninstall.sh-Skript übrig. |
| 8 | Kompilierung (make install) |
which <Name> → /usr/local/bin/ |
1. make uninstall (falls vorhanden)2. Andernfalls manuell |
Es ist das Entfernen oder checkinstall in der Zukunft |
| 9 | Manager (pipx, cargo, npm -g) |
which Name → ~/.local/bin/, ~/.cargo/bin/ |
pipx uninstall Name, cargo uninstall Name, npm uninstall -g Name |
Bricht das System nicht, kann aber mit apt-Versionen (z. B. node) konfliktieren. |
Dies ist eine unvollständige Liste, und ich hoffe, dass Sie andere Varianten nicht verwenden werden ![]()
go install,gem install- Docker / Podman-Images mit GUI
- Installation über linuxbrew / nix / guix
Was gilt nicht als eigene Installationsmethode
apt install ./file.deb→ Es ist immer noch die Installation eines.deb-Pakets, nur überapt, nicht überdpkg.- GUI-Installationsprogramme (Software Center, Discover) → Frontend für
apt/snap/flatpak. - „In Autostart hinzufügen“ /
systemd --user→ Dies ist bereits Nachinstallationskonfiguration, keine eigene Installationsmethode.
Wie kann man schnell die Installationsmethode einer unbekannten Anwendung ermitteln?
# 1. Wo liegt das Binärprogramm?
which Name
# 2. Woher stammt das Paket (falls aus apt/dpkg)
dpkg -S $(which Name) 2>/dev/null || echo "Nicht in dpkg"
# 3. Prüfen auf snap/flatpak
snap list | grep -i Name
flatpak list | grep -i Name
# 4. Prüfen, ob in ~/.local/bin oder /opt
ls -l $(which Name)
# 5. Installationshistorie (falls kürzlich)
grep "install.*Name" /var/log/apt/history.log 2>/dev/null
journalctl --since "2 weeks ago" | grep -i "install.*Name"
Tipps für eine saubere Systemstruktur:
- Für
.run-Programme in Zukunft: Betrachten Sie AppImage oder Isolation überbubblewrap/toolbox. - Statt
make installverwenden Siecheckinstall→ Erstellt ein.deb, leicht überaptzu entfernen. - Verwalten Sie benutzerdefinierte
.desktop-Dateien über~/.local/share/applications/— sie überschreiben immer die systemweiten.
Wo liegen alle Icons für das Anwendungs-Menü?
Dies ist kein Icon, sondern ein Startskript. Ähnlich wie die Skripte, die für den Start von Diensten verwendet werden (erinnern Sie sich?)
Ein möglicher Ort:
/usr/share/applications/
Analyse der Anwendung Telegram
ls -l /usr/share/applications/ | grep -i tele
-rw-r--r-- 1 root root 371 Mar 6 2020 telegram.desktop
cat /usr/share/applications/telegram.desktop
[Desktop Entry]
Encoding=UTF-8
Version=1.0
Type=Application
Terminal=false
Name=Telegram Desktop
Exec=/opt/telegram/Telegram -- %u
Comment=Official desktop version of Telegram messaging app
Icon=/opt/telegram/telegram.svg
StartupWMClass=Telegram
Categories=GNOME;GTK;Network;
MimeType=application/x-xdg-protocol-tg;x-scheme-handler/tg;
X-Desktop-File-Install-Version=0.22
Aus diesem Skript ist ersichtlich, dass das ausführbare Programm sich in
ls -l /opt/telegram/
total 190652
-rwxr-xr-x 1 root root 55 Mar 6 2020 Telegram
-rwxrwxr-x 1 root root 2184648 Nov 8 14:17 Updater
-rwxrwxr-x 1 root root 193023296 Nov 8 14:17 telegram
-rw-r--r-- 1 root root 4762 Mar 6 2020 telegram.svg
befindet.
Jetzt ist klar, dass die Signatur dieses Icons „Telegram Desktop“ lautet.
Die Angabe weist auf die Datei /opt/telegram/Telegram hin. Sie ist vermutlich sehr klein (55 Bytes). Schauen wir uns den Inhalt an:
cat /opt/telegram/Telegram
#!/usr/bin/env bash
/opt/telegram/telegram -noupdate $@
Dies ist ein Wrapper-Skript („wrap“ = „Umhüllung“), das wiederum /opt/telegram/telegram mit der Kommandozeilenoption aufruft, die Telegram auffordert, keine Updates zu überprüfen und nicht automatisch zu installieren.
$@ ist eine spezielle Variable, die in einzelne Argumente aufgelöst wird, die dem Skript übergeben wurden. Es wird empfohlen, diese Konstruktion in doppelten Anführungszeichen zu verwenden, um Probleme zu vermeiden, wenn ein Argument Leerzeichen enthält. Aber hier scheint dies nicht der Fall zu sein, da es sich um einen Benutzernamen oder Login handelt, in dem Leerzeichen und Sonderzeichen verboten sind.
Die Datei /opt/telegram/telegram ist ausführbar — sie trägt den Attribut x (für Verzeichnisse bedeutet dieser Attribut, dass man durch das Verzeichnis navigieren kann, selbst wenn der Benutzer keine Leseberechtigung für den Inhalt hat).
**
Dies ist nur ein Icon und was damit verbunden ist. Es ist noch nicht klar, wie die Anwendung installiert wurde. Laut Tabelle scheint es ein run-Installationsprogramm zu sein, aber das ist nicht sicher. Telegram wird entweder als snap im App-Store oder als tar.gz-Archiv geliefert. Das letztere scheint wahrscheinlicher.
Um die Dateien des zweiten Programms zu finden, verwenden wir den Befehl whence.
whence
Dies ist eigentlich kein Befehl, sondern ein Alias (d. h. hinter dem Wort „Befehl“ verborgen sind mehrere Zeilen Code).
Öffnen Sie Ihre ~/.bash_aliases — falls die Datei nicht existiert, erstellen Sie sie. Fügen Sie diese Zeilen hinzu:
# whence — schnelle Prüfung der Installationsmethode
whence() {
local prog="$1"
[ -z "$prog" ] && { echo "Usage: whence <program>" ; re```bash
turn 1; }
echo "=== $prog ==="
echo "• which: $(which \"$prog\" 2>/dev/null || echo '—')"
echo "• snap: $(snap list 2>/dev/null | grep "^$prog " || echo '—')"
echo "• flatpak: $(flatpak list --app 2>/dev/null | awk -v p=\"$prog\" '$1==p {print $1\":\"$3}' || echo '—')"
echo "• dpkg: $(dpkg -S \"$(which \"$prog\" 2>/dev/null)\" 2>/dev/null | cut -d: -f1 || echo '—')"
echo "• .desktop: $(find ~/.local/share/applications /usr/share/applications -name \"*$prog*.desktop\" 2>/dev/null | head -1 || echo '—')"
}
So, .bash_aliases is called by the file ~/.bashrc. Therefore, after making changes to the file, apply them (these changes will only take effect in the terminal session where you run the command below (or upon a new login to the system)):
source ~/.bashrc
Nothing will appear to change externally, but new variables and aliases will be available in the session.
Check:
whence telegram
=== telegram ===
• which: —
• snap: —
• flatpak:
• dpkg:
• .desktop: /home/ivan/.local/share/applications/org.telegram.desktop._18faa92ddda377ceaa5a576303af9e59.desktop
You can notice that the .desktop file here is not located in the system directory /usr/share/applications/, but in the home directory (see how many there are):
ls -l ~/.local/share/applications/
-rwxrwxr-x 1 ivan ivan 579 Nov 8 16:22 org.telegram.desktop._18faa92ddda377ceaa5a576303af9e59.desktop
For now, we are interested in the contents of this file:
cat ~/.local/share/applications/org.telegram.desktop*
[Desktop Entry]
Name=Telegram
Comment=New era of messaging
TryExec=/opt/telegram/telegram
Exec=/opt/telegram/telegram -- %u
Icon=org.telegram.desktop
Terminal=false
StartupWMClass=TelegramDesktop
Type=Application
Categories=Chat;Network;InstantMessaging;Qt;
MimeType=x-scheme-handler/tg;x-scheme-handler/tonsite;
Keywords=tg;chat;im;messaging;messenger;sms;tdesktop;
Actions=quit;
DBusActivatable=true
SingleMainWindow=true
X-GNOME-UsesNotifications=true
X-GNOME-SingleWindow=true
[Desktop Action quit]
Exec=/opt/telegram/telegram -quit
Name=Quit Telegram
Icon=application-exit
The icon’s name is Telegram (without Desktop).
The script points to the same executable file /opt/telegram/telegram, but without passing the variable and the “do not update” key. I don’t know why. My inner voice suggests that the developer should have a consistent approach regardless of deployment options. But here, this point is probably not critical. Passing the login is not mandatory — it will be pulled from settings. The difference will be only in automatic software updates. And by the way, the user will see a notification in one case that Telegram needs to be updated, while in the other, the application will update itself and wait for a restart (but this is not guaranteed).
In short, we found that both icons lead to the same instance of Telegram — which is the most important thing. Now we can remove one of them, since the program and settings (profile) are shared.
Let’s remove the less attractive one:
~/.local/share/applications/org.telegram.desktop._18faa92ddda377ceaa5a576303af9e59.desktop
DO NOT DELETE the file. Icon hiding is done differently!
Removing Only the Telegram Icon from the Menu (Leaving the Program and Service)
Add the parameter Hidden=true to the [Desktop Entry] section in the script:
sed -i '/^\\[Desktop Entry\\]$/a Hidden=true' ~/.local/share/applications/org.telegram.desktop._18faa92ddda377ceaa5a576303af9e59.desktop
Note: This is a simplified command. It does not consider whether such a line already exists in the file (on subsequent runs) or not. But duplicates are not a problem.
The change will take effect immediately — the icon will disappear from the menu. To restore the icon, simply delete the newly added line (indicated by the arrow).

