When a directory contains some files with non-empty extended attributes, all the attribute values can be shown as follows:

$ getfattr -d *
# file: file1

# file: file2

This should work for all the Linux distributions.

Is it possible to list only the files whose user.comment extended attribute has a specific value, for example comment1? If yes, how?


Try issuing getfattr -n user.comment --only-values * | grep -B 1 "comment1"

This will display the user.comment values of all files and filter the output with grep. You can of course use more sophisticated approaches, for example with find -exec

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.