25

On some key folders in nautilus I've changed the folder icons. It looks nice, and aids my productivity because I can easily find important folders in a mass of others.

But then I move to another machine and all the folders are plain again.

So the question is where is this stored, and is there a way to have it persist between users/systems.

4 Answers 4

17

Take a look in /usr/share/icons.

Gnome stores its icons there.

4
  • Those are icons that ship with the system or that are otherwise provided by Ubuntu packages. Data added by the user are not stored there. See the FHS for details on what the /usr/share directory contains. Jan 6, 2013 at 2:30
  • 4
    @EliahKagan, In the question the user did not say "my own icons". Sep 25, 2013 at 21:29
  • 1
    That's where icons are, but not where the association with specific directories are. You may choose a file from the standard icons to represent one folder, but the issue is that if you then view that folder from another computer or another user on the same computer you will not see that icon. Jul 23, 2015 at 22:31
  • On Fedora, more precisely here: /usr/share/icons/Adwaita/scalable/places
    – tronic
    Jan 30 at 12:53
16

The meta-data is stored using the meta-data storage system of GIO/GVFS. You can see what attributes are stored on a file by running gvfs-info /path/to/file in a terminal. To have the same folders with the same icons on a different machine, you'll generally have to manually set the icons again. Also note that the custom icons won't show up when browsing the folders remotely via sftp or some similar means.

1
  • 2
    And you can change them with gvfs-set-attribute (for example in a script)
    – saeedgnu
    Jun 6, 2013 at 12:22
5

gio info

Since gvfs-info is outdated, use gio info instead. To get information about a dir/file simple use

gio info /path/to/director/or/file

After invoking this command you will get an output like

...
metadata::custom-icon: file:///home/.../.../myicon.png
...

If you would like the exact full-path name of your icon in a script use something like:

gio info /path/to/director/or/file | awk '/custom-icon/ {print $2}' | cut -c8-

Usage: gio info [OPTION…] LOCATION…

Show information about locations.

Options:
-w, --query-writable : List writable attributes
-f, --filesystem : Get file system info
-a, --attributes=ATTRIBUTES: The attributes to get
-n, --nofollow-symlinks: Don’t follow symbolic links

gio info is similar to the traditional ls utility, but using GIO locations instead of local files: for example, you can use something like smb://server/resource/file.txt as location. File attributes can be specified with their GIO name, e.g. standard::icon, or just by namespace, e.g. unix, or by “*”, which matches all attributes

How to set an icon from command line can be found here.

A complete set of the gio commands can be found on the gnome developer page.

4
  • Thanks for the update! May 4, 2020 at 15:03
  • Any reason to not update the existing answer? While gio info may be the way to do it on the latest release of Ubuntu, gvfs-info is still the way it works on some older versions which are still supported. So outdated isn't quite entirely true in respect to giving answers here.
    – dobey
    May 6, 2020 at 0:34
  • According to the man page of gvfs-info: "gvfs-info has been deprecated and it is redirected to gio info." It's true that gvfs still works and is available, even on Ubuntu 20.04.
    – abu_bua
    May 6, 2020 at 0:47
  • Yes. On 20.04. However, 16.04 and 18.04 are still supported. And 14.04 and possibly 12.04 for those paying Canonical for extended support. Thus, the instructions to use gvfs-info are still very valid, especially since this question was asked in 2012 anyway. gio info does not necessarily even exist on those older versions of Ubuntu.
    – dobey
    May 7, 2020 at 18:05
3

No, wait, you got the wrong answer. Icon settings can be copied over from machine to machine, of course they can, there's nothing you can't do on Linux.

Icon settings are stored in the folder:

~/.local/share/gvfs-metadata

If you'd like you can try it on a virtual machine, what you have to do is:

  • Copy all of your files from your old system (system backup) to new system (all of ~/ directory)
  • Make sure you have copied over the gvfs-metadata folder, as well as the folder that includes your custom icons (I would assume it is ~/.icons). If you have copied all of ~/, this would be automatically done.
  • Delete the gvfs-metadata you have just copied, and copy it again from system backup.
  • Do: $: killall nautilus

And there you go, you have them back.

I have just moved to a new computer and it worked for me. I tested it also on a VM.

Note: if you do gvfs-info folder_name you won't see the custom icon path unless you have copied over the gvfs-metadata folder. As this instruction checks that folder for information.

2
  • The only answer that tells where the metadata seen with gio info is stored, which was the actual OP question. This truly deserves more upvotes.
    – MestreLion
    Aug 22, 2023 at 18:48
  • 2 curiosities: This is still the path used by modern gio, even if the gvfs-info tool is deprecated. And being in ~/.local/share means any metadata (such as icon customizations) applies to your user only.
    – MestreLion
    Aug 22, 2023 at 18:53

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .