nerdexam
Linux_Foundation

LFCS · Question #371

Which of the following statements is true when querying the extended attributes of a file that has no extended attributes set?

The correct answer is C. No output will be produced and getfattr will exit with a value of 0. When getfattr is used to query a file that lacks extended attributes, it produces no output and indicates success by exiting with a status code of 0.

Submitted by klara.se· Apr 18, 2026Essential Commands

Question

Which of the following statements is true when querying the extended attributes of a file that has no extended attributes set?

Options

  • Agetfattr will print a warning and exit with a value of 0.
  • Bgetfattr will print a warning and exit with a value of 1.
  • CNo output will be produced and getfattr will exit with a value of 0.
  • DNo output will be produced and getfattr will exit with a value of 1.

How the community answered

(58 responses)
  • A
    2% (1)
  • B
    2% (1)
  • C
    93% (54)
  • D
    3% (2)

Why each option

When `getfattr` is used to query a file that lacks extended attributes, it produces no output and indicates success by exiting with a status code of 0.

Agetfattr will print a warning and exit with a value of 0.

`getfattr` does not print a warning; it simply outputs nothing when no attributes are found.

Bgetfattr will print a warning and exit with a value of 1.

`getfattr` does not print a warning nor does it exit with a non-zero status code, as it considers finding no attributes a successful query.

CNo output will be produced and getfattr will exit with a value of 0.Correct

The `getfattr` command, when executed on a file without extended attributes, will silently succeed. It does not output any warning or error messages, and it exits with a status code of 0, indicating successful execution.

DNo output will be produced and getfattr will exit with a value of 1.

`getfattr` exits with a value of 0, indicating success, not 1, when no attributes are found.

Concept tested: Linux extended attributes getfattr behavior

Source: https://www.man7.org/linux/man-pages/man1/getfattr.1.html

Topics

#Extended Attributes#getfattr command#File Attributes#Command exit codes

Community Discussion

No community discussion yet for this question.

Full LFCS Practice