I know how to change the icon of a specific file via Nautilus : right click > Properties see picture. Is there a way to do the same action from the terminal? At least, does someone know where is stored the path to the icon for a specific file?

I am not interested in creating a .desktop file.

Thank you.

1 Answer 1


You can use gio for this. For instance, to set it to text-x-plain, you could do:

gio set <location> metadata::custom-icon-name text-x-plain
  • Yes! gio is the solution. Here is the exact command I used: gio set file_to_add_icon_to 'metadata::custom-icon' 'file:///path/to/the/icon/file'
    – zigma12
    Commented Aug 3, 2022 at 11:30

You must log in to answer this question.

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