For some reason I have a bunch of left-over start menu entries from applications (e.g, Gnome Do, Synapse, Leafpad.) and was wondering if there's a way to remove all orphaned entries for applications that are no longer installed?

6 Answers 6


You can use the following command to list application icons that link to nonexistent programs:

for i in {/usr,~/.local}/share/applications/*.desktop; do which $(grep -Poh '(?<=Exec=).*?( |$)' $i) > /dev/null || echo $i; done

I suspect you'll find that most of yours are customized icons in your home folder, since these are not automatically cleaned up by the package manager. If this is the case and you'd like to trash Install trash-cli them all at once, you can use a modification of the previous command:

for i in ~/.local/share/applications/*.desktop; do which $(grep -Poh '(?<=Exec=).*?( |$)' $i) > /dev/null || trash $i; done

Or, of course, browse to ~/.local/share/applications/ in Nautilus and trash them via the graphical interface.

  • 1
    That did the trick! Is there anyway I can turn that into a shortcut that I can run when such a thing happens again?
    – Alan
    May 21, 2011 at 18:13
  • the answer by intika ( askubuntu.com/a/1185127/148272 ) expands on this and scans subfolders too :)
    – allanlaal
    Jul 7, 2021 at 16:16

If by start menu you mean the 'Applications' menu, you can edit it by going to: System -> Preferences -> Main Menu.

You can add, rearrange, edit and delete entries at will.

  • Hi Eugenio. That's correct, but I have to go through each one, confirm if it really is orphaned or not, and then delete it. I'm looking for a way that would do all of this for me, as I have about 40+ entries that I want to remove.
    – Alan
    May 7, 2011 at 2:58
  • Probably the most noob-friendly answer. +1
    – tir38
    Dec 27, 2013 at 7:53

When an application is uninstalled it should remove menu items it installed. And it work this way on my machine.

If it works differently, it is a bug of a particular package or a problem on your system. I cannot believe that you have more than 40 entry orphaned. It would be the symptom of a problem.

  • It's very strange, I've never had this problem until my upgrade to Natty Narwhal. I may downgrade to 10.04LTS, and wait a short while until 11.04 is a little more bug-free.
    – Alan
    May 21, 2011 at 18:15
  • There are programs that actively install themselves but which don't have an actual installer per se. They get orphaned if the binary is moved.
    – Pointy
    Feb 5, 2019 at 23:38


Following @ændrük answer, here is a similar solution that support spaces in path and subfolders, this can be used on a specific folder or the the entire disk to look for broken .desktop files (shortcut)

find {/usr,~/.local,/usr/local,}/share/applications/ -name '*.desktop' | while read -r line; do which $(grep -Poh '(?<=Exec=).*?( |$)' $line) > /dev/null || echo $line;  done

For the entire disk

find / -name '*.desktop' | while read -r line; do which $(grep -Poh '(?<=Exec=).*?( |$)' $line) > /dev/null || echo $line;  done

Note: that any method can show false positive check twice found files before deleting them


Well, this one is hard but i want, at least, to tell you what's the problem.

Gnome stores the installed applications in /usr/share/applications with files ended in .desktop (so vlc program is launchad by vlc.desktop)

Inside each one, there's a "Category" section in which you can set in what part of the Applications menu that program you want it to be. The thing is: the only way i think it can be done what you are asking for is using a bash script that ask if the package related to that .desktop is installed or not. if it's not, delete that .desktop file. When you delete the file, it will be out of the menu, and when you app is in a category, that one isn't shown.

That one is a bit out of my scope because every command (dpkg, apt-get, etc..) always return a good exit when they say the package isn't installed, so we have to read the exit from that app searching for a String (f.i. "not installed"), check it, and if the String exists, it means the application isn't installed and the .desktop can be deleted.

So, if you want, you could just enter the folder (/usr/share/applications) and click on files that correspond to the programs. They'll dissappear from the Applications menu. To do it automatically, i guess we need a good bash script on the track i said.

I hope this helps in some way.

  • Hi David, thanks for your help! That tip about going into /usr/share/applications is certainly a time saver compared to deleting the broken links one-by-one in the menu editor.
    – Alan
    May 21, 2011 at 18:23

I found on the internet a very smart person who knew of a program called Alacarte (easy GNOME menu editing) program. It installed using the software manager. It's so easy to use. Just click on to highlight the uninstalled program entry you want to get rid of and click delete on the right and it's done.

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.