6

I am using Ubuntu 12.04 LTS, and I want "XnRetro.desktop" file to be removed from directory /usr/share/applications using terminal . How to do it ?

I am new into Linux & I know something like "rm" command is used, but I don't wanna risk as there are many other files too in it.

Regards.

  • You should remove the application that installed that file, not just remove the .desktop file. – Thomas Ward Jun 02 '13 at 22:20
  • I don't wanna remove the application, I just want that application not to appear in Gnome menu (: – Suyaargappamaareche Jun 02 '13 at 22:21
  • @Suyaargappamaareche you can edit the desktop file so it doensn't appear in the menu, without removing it entirely. I forget how, but I think it's pretty easy to figure out once you look inside the file. – strugee Jun 02 '13 at 22:53

2 Answers2

7

I don't recommend you remove anything by hand from the /usr folder, but if you REALLY want to not listen to my recommendation you can remove it with this command:

sudo rm /usr/share/applications/XnRetro.desktop

But I really don't recommend that you remove things from /usr without removing whatever installed to there, because it can sometimes cause problems.

You might want to consider as an alternative moving the file so it has a .old extension. The method as outlined in another answer here, by Daniel, explains how to do this by using this command:

sudo mv /usr/share/applications/XnRetro.desktop /usr/share/applications/XnRetro.desktop.old

Thomas Ward
  • 74,764
  • Thank you very much for helping out. I just wanna learn so I gotta test it (: – Suyaargappamaareche Jun 02 '13 at 22:32
  • 1
    If you're anxious about removing files, make a habit of using "rm -iv" ... The "-i" (for interactive) will prompt you "yes/no" for every file, and "-v" (for verbose) adds a line of output confirming each deletion. – Steven K Jun 02 '13 at 23:05
  • @StevenKath True, however if you're only removing one file there's no real need for interactive verbosity. – Thomas Ward Jun 02 '13 at 23:16
  • @TheLordofTime Of course, but the whole point of the question is the asker isn't familiar enough with Linux to know whether or not they're deleting just one file. ("I know something like "rm" command is used, but I don't wanna risk as there are many other files too in it.") In this case, I think "rm -iv" is a handy learning tool and safety net to get in the habit of using. – Steven K Jun 02 '13 at 23:35
3

A more elegant solution would be using mv.
Type

sudo mv /usr/share/applications/XnRetro.desktop /usr/share/applications/XnRetro.desktop.old

This way you rename the file so it won't be recognized anymore and since the ending is not .desktop it won't show.

If you noticed anything is messed up because of the change you can just use mv again to rename the file to its original name.

Daniel W.
  • 3,436