As described in xattr(7) extended attributes are name:value pairs associated with
each file on the filesystem
in Linux the only supported namespace classes are security, system, trusted and
user which is the most general of these.
The following command sets a user extended attributes of the file foo.txt
setfattr -n user.mime_type -v text/plain foo.txtTo retrieve the previously set extended attribute we use the following command
getfattr -n user.mime_type foo.txtIn order to use extended attributes for tagging we first need to specify a format for file tags. The following is a proposed format
‘tag_1:tag_2:…:tag_n’
We separate each tag with colon.
Then we can use the name user.tags to set tags with
setfattr -n user.tags -v family photo.jpg