Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In Ubuntu, is it possible to change the icon for a specific file from the command line? I want to create a shortcut with a custom icon, so I'll need a way to change a specific file's icon. (Instead of changing the icon associated with a filetype, I want to change the icon associated with just one specific file.)

share|improve this question
As an example, I might have a script called saved on the desktop. In this case, how could I change the icon for that specific file? – Anderson Green Dec 15 '12 at 7:24
I don't think that is possible. You may create a .desktop file pointing to your script and change that icon. Anyway I am not sure, lets wait for a good answer – Web-E Dec 15 '12 at 7:29
@Web-E Why do you think it's impossible? It's possible to do this on Windows (e. g., specific icons for individual files in Dropbox), so why not on Ubuntu? – Anderson Green Dec 15 '12 at 7:30
@Web-E Specifically, how can you change a .desktop file's icon using the command line? – Anderson Green Dec 15 '12 at 7:32
First you need to create .desktop file. From command line you have to create the lines one by one. Icon=<ICON_IMG> this line will change the icon. For existing .desktop file you need to replace that line. You can use sed utility for replacement. – Web-E Dec 15 '12 at 7:35

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.