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

When I copy a file through Nautilus its emblem or icon is preserved, but if I do it with cp or rsync through CLI it isn't. Why, and how to fix it?

By preserved I mean that icons that I have manually changed stay like that when copying through Nautilus, and are otherwise reset to the default icons when copying through CLI.

share|improve this question
up vote 3 down vote accepted

I wrote a small Perl script that solves this issue, metasave. It saves nautilus metadata in the form of a shell script that you need to run on the destination system.

If you want to copy files on the command line and preserve their metadata, you need to use gvfs-copy, Gnome's replacement of cp.

share|improve this answer
I didn't know about gvfs-copy, thank you. It's unfortunate that there isn't a gvfs-rsync. – Strapakowsky Nov 3 '12 at 3:59

WHY: Emblems are not a part of the file itself, they're stored somewhere inside Gnome - when you copy files using Nautilus, it is able to update the metadata in Gnome because Nautilus is a Gnome app and is aware of the existance of labels and emblems.

cp, rsync and other non-Gnome commands, on the other hand, know nothing about labels and emblems and can do nothing to preserve them.

HOW TO FIX: There may be no good way to fix it for every command-line utility which copies files. For some selected commands, such as cp you may look at writing some wrappers which set the emblems of the target files to match the emblems of the source files. This post may give you some pointers at how to set emblems from command line

share|improve this answer
Are all emblems icons? Does what you described for emblem apply for icons in general as well? – Strapakowsky Jun 4 '12 at 1:03
Great link ! Didn't know how to do that. In any case my problem here is that when I rsync a folder icons in dest are reset. – Strapakowsky Jun 4 '12 at 1:05
What do you mean by "icons are reset"? Do you mean the main file icon is getting changed? From what is it getting changed to what? – Sergey Jun 4 '12 at 1:28
Edited question to clarify that, thank you. – Strapakowsky Jun 5 '12 at 14:40

Try using rsync with the archive flag:

rsync -av <source> <dest>

It could be that nautilus is preserving permissions such as executable and rsync & cp unless told are not.

share|improve this answer
Doesn't fix it. – Strapakowsky Jun 4 '12 at 0:52

Your Answer


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

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