GETFATTR(1)

โœจ getfattr โ€” bestie edition โœจ

okay so this is getfattr(1), a lil tool from the File Utilities corner of your system, and it's genuinely one of my faves. no cap.


๐ŸŒธ NAME ๐ŸŒธ

getfattr โ€” get extended attributes of filesystem objects ๐Ÿ’–

like, the lil secret extra tags that files carry around that nobody talks about. iykyk.


๐ŸŽ€ SYNOPSIS ๐ŸŽ€

getfattr [-hRLP] -n name [-e en] pathname...
getfattr [-hRLP] -d [-e en] [-m pattern] pathname...

two whole modes, bestie. either you're asking for one specific attribute by name, or you're doing a full dump of everything that matches. pick your fighter ๐Ÿ’…


๐Ÿฆ‹ DESCRIPTION ๐Ÿฆ‹

So for each file you hand it, getfattr shows you the file name, and then the whole set of extended attribute names โ€” and optionally their values too โ€” that are attached to that file. by default it only shows you attributes in the user namespace, and if you're like "wait, why" the answer is over in -m, keep scrolling ๐Ÿซถ

The output format of getfattr -d is exactly this vibe:

1:  # file: somedir/
2:  user.name0="value0"
3:  user.name1="value1"
4:  user.name2="value2"
5:  ...

Line 1 is the file name for which the lines after it are being reported โ€” that's the little label telling you whose attributes you're looking at. The remaining lines (lines 2 to 4 up there) show the name and value pairs associated with the file you specified. cute, right? ๐Ÿ’–


๐Ÿ‘‘ OPTIONS ๐Ÿ‘‘

  • -n name, --name=name โ€” dump the value of the named extended attribute. just the one you asked for, main character treatment โœจ
  • -d, --dump โ€” dump the values of all matched extended attributes. the full haul, the whole fit ๐ŸŒˆ
  • -e en, --encoding=en โ€” encode values after retrieving them. valid values of en are "text", "hex", and "base64". values encoded as text strings get wrapped in double quotes ("), while strings encoded as hexadecimal and base64 are prefixed with 0x and 0s, respectively. so you always know which one you're looking at ๐Ÿ’…
  • -h, --no-dereference โ€” do NOT dereference symlinks. instead of the file the symlink points at, the symlink itself is what gets examined. it's giving "i said what i said" ๐Ÿ˜ค
  • -m pattern, --match=pattern โ€” only include attributes whose names match the regular expression pattern. the default value for pattern is "^user\\.", which grabs all the attributes in the user namespace. specify "-" if you wanna include all attributes, no filtering, chaos mode. refer to xattr(7) for a much more detailed discussion of namespaces, fr fr ๐Ÿ“š
  • --absolute-names โ€” do not strip leading slash characters (/). the default behaviour is to strip leading slash characters. so this flag is you saying "leave my slashes alone" ๐Ÿ™ˆ
  • --only-values โ€” dump out the raw extended attribute value(s) without encoding them. no quotes, no prefixes, no makeup, just the raw data ๐Ÿ’€
  • -R, --recursive โ€” list the attributes of all files and directories recursively. this option is commonly used together with option -h. they're a package deal, honestly ๐Ÿซถ
  • -L, --logical โ€” logical walk, recurse into symbolic links that refer to a directory. only effective in combination with -R. the default behaviour is to recurse into symbolic links given on the command line, and not to recurse into symbolic links encountered in subdirectories. so this is you opting into the extra โœจ
  • -P, --physical โ€” physical walk, do not recurse into symbolic links that refer to a directory. only effective in combination with -R. (for pathnames given on the command line, this option applies only to the final component; preceding path components may still be symbolic links.) lowkey a lot of nuance but we respect it ๐ŸŽ€
  • --version โ€” print the version of getfattr and exit. quick lil flex, then bye ๐Ÿ‘‹
  • --help โ€” print help explaining the command line options. when in doubt, ask ๐Ÿฆ‹
  • -- โ€” end of command line options. all remaining parameters are interpreted as file names, even if they start with a dash character. this is the "okay we're done with flags now" line, iconic behaviour โญ

๐Ÿ’œ AUTHOR ๐Ÿ’œ

Andreas Gruenbacher, <andreas.gruenbacher@gmail.com> and the SGI XFS development team, <linux-xfs@oss.sgi.com>. legends, honestly ๐Ÿ‘‘

Please send your bug reports or comments to <https://savannah.nongnu.org/bugs/?group=attr> or <acl-devel@nongnu.org>. they wanna hear from you, bestie, don't be shy ๐Ÿซถ


๐ŸŒˆ SEE ALSO ๐ŸŒˆ

setfattr(1), xattr(7)


mwah ๐Ÿ’‹ this page is from the Extended Attributes manual, dated Dec 2001 โ€” yeah she's been around a while and she still ate. periodt. ๐ŸŽ€โœจ

๐Ÿ“ฆ where this page comes from