Aller au contenu

xattr

alubook:Custom bruno$ ls -la
total 7960
drwxr-xr-x  18 bruno  staff      612 24 déc 09:11 .
drwx------+ 92 bruno  staff     3128 24 déc 09:05 ..
-rw-r--r--@  1 bruno  staff     6148 24 déc 09:05 .DS_Store
-rw-r--r--   1 bruno  staff      558  7 oct 01:14 Localizable.strings
-rw-r--r--@  1 bruno  staff    16836 24 déc 08:28 MacOSX copie.png
-rw-r--r--   1 bruno  staff    10284 21 aoû 03:00 MacOSX.png

1er caractère

  • d: dossier

  • -: fichier

Dernier caractère:

  • @: extended attributes

  • +: extended security information (acl)

Afficher les attributs étendus: xattr -l <filename>

Effacer un attribut étendu: xattr -d com.apple.quarantine my_jar.jar

Effacer tous les attributs étendus: xattr -c my_jar.jar

Affiche les attributs étendus:

$ xattr tabColor.sh
com.apple.TextEncoding
com.apple.lastuseddate#PS
com.apple.macl
com.apple.metadata:_kMDItemUserTags
com.apple.metadata:kMDItemDownloadedDate
com.apple.metadata:kMDItemWhereFroms
com.apple.metadata:kMDLabel_mpkqupmo7cxdxxjnmfdfxofpfe
com.apple.quarantine

Affiche les attributs étendus et leur valeur:

$ xattr -l tabColor.sh
com.apple.TextEncoding: UTF-8;134217984
com.apple.lastuseddate#PS: ��]
com.apple.macl:
com.apple.metadata:_kMDItemUserTags: bplist00�
com.apple.metadata:kMDItemDownloadedDate: bplist00�3A�Yw��#�

com.apple.metadata:kMDItemWhereFroms: bplist00�_Ahttps://www.admin-linux.fr/wp-content/uploads/2013/09/tabColor.sh

com.apple.metadata:kMDLabel_mpkqupmo7cxdxxjnmfdfxofpfe: �
com.apple.quarantine: 0081;00000000;;

Affiche (-p (print)) la valeur d'un attribut étendu:

$ xattr -p com.apple.TextEncoding tabColor.sh
UTF-8;134217984

Modifie (-w (write)) la valeur d'un attribut étendu:

$ xattr -w <attribut> <valeur> tabColor.sh

Supprime (-d (delete)) l'attribut étendu et sa valeur:

$ xattr -d <attribut> tabColor.sh

Supprime (-c (clear)) tous les attributs étendus:

$ xattr -c tabColor.sh

Options:

  • -l
  • -r: récursive
  • -s
  • -v
  • -x

https://developer.apple.com/library/archive/documentation/CoreServices/Reference/MetadataAttributesRef/MetadataAttrRef.html#//apple_ref/doc/uid/TP40001691-BCICJDHA


Dernière mise à jour: November 9, 2023