6

As the folder name says /usr/share/applications... are these all my applications installed in the system?

Will deleting a program's icon in below pics mean uninstalling it from the system permanently?

For example, I see Amazon & Cheese icons twice... Files icon thrice

icons in /usr/share/applications

icons in /usr/share/applications

This is a freshly installed Ubuntu 18.04 and I've just installed Audacious, MPV player, Dconf & GNOME Tweaks.

My intention:

  1. How can I know which icon is the actual application that I have to keep? For example I want to remove Amazon completely from my system. Of the two Archive Manager icons, I want to keep the actual working one and remove the other...
  2. How can I know the name of application that can be removed via command line, for example

    sudo apt remove Amazon
    sudo apt remove Audacious Qt Interface 
    sudo apt remove Cheese-not-in-use
    sudo apt remove Files1-not-in-use  
    sudo apt remove Files2-not-in-use  
    

Final Goal:

If I want Audacious, MPV player, Dconf, Files, Cheese, InputMethod, Keyboard, Gparted, Displays, Dock, Disks, Calendar only, then I want to see only 12 icons in this folder.

Is this achievable?

2 Answers 2

9

Desktop Entries are either created by the applications or by the user as per his convenience. Not all Desktop Entries refer to application. Remember it might happen a user has created a script and to run that he used a Desktop Entry. So not all desktop entry refer to application. It is also to be noted that not all Desktop Entries are in /usr/share/applications.

  • are these all my applications installed in the system?

    Most probably yes if all these are created by system/application itself. Desktop entries are created at the time of installation of a software (if software knows how to create that like Google Chrome does but Netbeans doesn't).

  • deleting icon in below pics, means uninstalling it from the system permanently?

    Not really. You are just deleting a way (shortcut) to launch a specific application not an application which will still exist after the .desktop file is deleted.

  • how to know which icon is the actual application that i have to keep

    You need to open duplicate desktop entries through a text editor and determine which functionality it offers or for what purpose it is there. Multiple desktop entries must have created multiple shortcuts in app drawer but out of those multiple desktop entries only 1 is visible and every other will be hidden due to NoDisplay=true in their description. That's why only 1 is visible in app drawer. It may also contain a line OnlyShownIn or NotShowIn to show or hide in specific DE.You can learn more about it at Desktop Entry Specification

  • how to know the name of application that can be remove via command line

    For this refer N0rbert's answer

  • if i want Audacious, MPV player, Dconf, Files, Cheese, InputMethod, Keyboard, Gparted, Displays, Dock, Disks, Calendar only then i want to see only 12 icons in this folder.

    No. Some entries like that of Bluetooth are defined by the system and it needs that to properly display it while using a search.

7
  • 3
    Nice, I'd like to mention that multiple entries are used for different purposes, e.g. Files has different .desktop- files, one is used in the dashboard, another one will be used in the taskbar, so none of them should be deleted.
    – mook765
    Dec 23, 2018 at 10:17
  • @mook765 Yeah that's what I meant by determine which functionality it offers in point 3.
    – Kulfy
    Dec 23, 2018 at 10:20
  • @Kulfy good answer, but I disagree with the first point. Those are only the applications that offer a GUI. Most CLI only applications don't come with a desktop entry.
    – danzel
    Dec 23, 2018 at 10:54
  • @danzel I agree. IMO GUI is also offered by an executable file to make app interactive. But if the desktop entry is created by user it might be used to just execute a script. One of my friend created the desktop entry to execute a script because he was facing some sort of problems and that script has to be executed once in a while.
    – Kulfy
    Dec 23, 2018 at 11:00
  • @danzel Most CLI only applications don't come with a desktop entry: Python also have a Desktop Entry by default. For reference you can look into the screenshot in question body. :)
    – Kulfy
    Dec 23, 2018 at 11:04
4

If you went here with MacOS habits, do not expect that pressing Shift+ Delete will remove things.

In Ubuntu this folder contains many *.desktop files for installed applications.

If they were installed by APT then you can use the power of dpkg to manage them.

So you can find Amazon with:

ls -1 /usr/share/applications/ | grep -i amazon

it will return

com.canonical.launcher.amazon.desktop
ubuntu-amazon-default.desktop

Afterwards you can find their packages with dpkg -S:

dpkg -S com.canonical.launcher.amazon.desktop ubuntu-amazon-default.desktop
ubuntu-web-launchers: /usr/share/applications/com.canonical.launcher.amazon.desktop
ubuntu-web-launchers: /usr/share/applications/ubuntu-amazon-default.desktop

and finally you can remove the related package:

sudo apt purge ubuntu-web-launchers

Programmatical way is below (warning: be careful with its execution - check the list of packages being removed before proceeding):

export ICONNAME=Amazon
sudo apt-get purge $(dpkg -S $(ls -1 /usr/share/applications/ | grep -i $ICONNAME) | awk '{print $1}' | sed 's/://' | sort -u)
8
  • I see that Kulfy's answer contains needed information. But my answer contains practical method. So both answers complete each other (thanks @Kulfy).
    – N0rbert
    Dec 23, 2018 at 10:00
  • 1
    @N0rbert That's why I've referred your answer to complete my answer :)
    – Kulfy
    Dec 23, 2018 at 10:02
  • @PRATAP it may lead to unpredictable behavior because of package dependencies. You should try this idea on clean VM with snapshots. I can't offer any warranty that system wont became broken completely.
    – N0rbert
    Dec 23, 2018 at 10:31
  • @N0rbert i am trying to use the command you mentioned under programmatical way.. as i am new.. i am confused with those two commands.. do i need to run those commands one by one or it needs to keep in script? i tried second command by replacing $ICONNAME with Sudoku
    – UnKNOWn
    Dec 23, 2018 at 13:52
  • pratap@PRATAP:~$ sudo apt-get purge $(dpkg -S $(ls -1 /usr/share/applications/ | grep -i Sudoku) | awk '{print $1}' | sed 's/://' | sort -u) dpkg-query: no path found matching pattern *Sudoku.desktop* [sudo] password for pratap: Reading package lists... Done Building dependency tree Reading state information... Done 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. pratap@PRATAP:~$
    – UnKNOWn
    Dec 23, 2018 at 13:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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