Why the "file --apple" command is not giving expected output?

Solution Verified - Updated -


  • Red Hat Enterprise Linux 8


  • --apple option in file command not giving the expected output for files and directories.

  • file --apple command gives "ERROR: (null)" or "UNKNUNKN" as output.


  • --apple option will work only for file formats that have the apple-style output defined.
  • For any other files or directories where apple-style is not defined, the file --apple command will give output as "ERROR: (null)" or "UNKNUNKN"

  • Internal Bugzilla has been created for modifying the man page for file command.

Diagnostic Steps

  • file --apple command output for regular files.

    # file test1.tar.gz --apple
    test1.tar.gz: UNKNUNKN                  <<<<<<<<
    # file test1.tar.gz 
    test1.tar.z: gzip compressed data, last modified: Thu Feb 14 23:13:08 2019, 
    from Unix, original size 10240
    # file --apple test_file                <<<<<<<< Empty text file
    test_file: ERROR: (null)                <<<<<<<<       
    # file test_file1         
    test_file: ASCII text
    # file --apple test_file1               <<<<<<<< Non-empty file
    test_file: UNKNUNKN                     <<<<<<<<
  • file --apple command output for character device files.

    # file /dev/tty
    /dev/tty: character special (5/0)
    # file /dev/tty --apple
    /dev/tty: ERROR: (null)                 <<<<<<<<
  • file --apple command output for a file with apple-style output defined.

    # file --mime TN001.SIT TN001.SIT: application/x-stuffit; charset=binary # file --apple TN001.SIT TN001.SIT: SIT!SIT! <<<<<<<<

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.