{
    "content": [
        {
            "type": "text",
            "text": "# file (man)\n\n## NAME\n\nfile — determine file type\n\n## SYNOPSIS\n\nfile   [-bcdEhiklLNnprsSvzZ0]  [--apple]  [--exclude-quiet]  [--extension]  [--mime-encoding]\n[--mime-type] [-e testname] [-F separator] [-f namefile] [-m magicfiles] [-P name=value]\nfile ...\nfile -C [-m magicfiles]\nfile [--help]\n\n## DESCRIPTION\n\nThis manual page documents version 5.45 of the file command.\n\n## TLDR\n\n> Determine file type.\n\n- Give a description of the type of the specified file:\n  `file {{path/to/file}}`\n- Do not print the filepath:\n  `file {{-b|--brief}} {{path/to/file}}`\n- Look inside a zipped file and determine the file type(s) inside:\n  `file {{-z|--uncompress}} {{path/to/file.zip}}`\n- Allow `file` to work with special or device files:\n  `file {{-s|--special-files}} {{path/to/file}}`\n- Don't stop at first file type match; keep going until the end of the file:\n  `file {{-k|--keep-going}} {{path/to/file}}`\n- Determine the MIME encoding type of a file:\n  `file {{-i|--mime}} {{path/to/file}}`\n\n*Source: tldr-pages*\n\n## Sections\n\n- **NAME**\n- **SYNOPSIS**\n- **DESCRIPTION**\n- **OPTIONS** (28 subsections)\n- **ENVIRONMENT** (1 subsections)\n- **FILES**\n- **EXIT STATUS**\n- **EXAMPLES**\n- **SEE ALSO**\n- **STANDARDS CONFORMANCE**\n- **SECURITY**\n- **MAGIC DIRECTORY**\n- **HISTORY**\n- **LEGAL NOTICE**\n- **BUGS**\n- **TODO**\n- **AVAILABILITY**\n\nUse structuredContent.sections for detailed options, examples, and full documentation.\n"
        }
    ],
    "structuredContent": {
        "command": "file",
        "section": "",
        "mode": "man",
        "summary": "file — determine file type",
        "synopsis": "file   [-bcdEhiklLNnprsSvzZ0]  [--apple]  [--exclude-quiet]  [--extension]  [--mime-encoding]\n[--mime-type] [-e testname] [-F separator] [-f namefile] [-m magicfiles] [-P name=value]\nfile ...\nfile -C [-m magicfiles]\nfile [--help]",
        "tldr_summary": "Determine file type.",
        "tldr_examples": [
            {
                "description": "Give a description of the type of the specified file",
                "command": "file {{path/to/file}}"
            },
            {
                "description": "Do not print the filepath",
                "command": "file {{-b|--brief}} {{path/to/file}}"
            },
            {
                "description": "Look inside a zipped file and determine the file type(s) inside",
                "command": "file {{-z|--uncompress}} {{path/to/file.zip}}"
            },
            {
                "description": "Allow `file` to work with special or device files",
                "command": "file {{-s|--special-files}} {{path/to/file}}"
            },
            {
                "description": "Don't stop at first file type match; keep going until the end of the file",
                "command": "file {{-k|--keep-going}} {{path/to/file}}"
            },
            {
                "description": "Determine the MIME encoding type of a file",
                "command": "file {{-i|--mime}} {{path/to/file}}"
            }
        ],
        "tldr_source": "official",
        "flags": [
            {
                "flag": "",
                "long": "--apple",
                "arg": null,
                "description": "Causes the file command to output the file type and creator code as used by older Ma‐ cOS versions. The code consists of eight letters, the first describing the file type, the latter the creator. This option works properly only for file formats that have the apple-style output defined."
            },
            {
                "flag": "-b",
                "long": "--brief",
                "arg": null,
                "description": "Do not prepend filenames to output lines (brief mode)."
            },
            {
                "flag": "-C",
                "long": "--compile",
                "arg": null,
                "description": "Write a magic.mgc output file that contains a pre-parsed version of the magic file or directory."
            },
            {
                "flag": "-c",
                "long": "--checking-printout",
                "arg": null,
                "description": "Cause a checking printout of the parsed form of the magic file. This is usually used in conjunction with the -m option to debug a new magic file before installing it."
            },
            {
                "flag": "-d",
                "long": null,
                "arg": null,
                "description": ""
            },
            {
                "flag": "-E",
                "long": null,
                "arg": null,
                "description": "output as POSIX mandates and keep going, issue an error message and exit."
            },
            {
                "flag": "-e",
                "long": "--exclude",
                "arg": null,
                "description": "Exclude the test named in testname from the list of tests made to determine the file type. Valid test names are: apptype EMX application type (only on EMX). ascii Various types of text files (this test will try to guess the text encoding, irrespective of the setting of the ‘encoding’ option). encoding Different text encodings for soft magic tests. tokens Ignored for backwards compatibility. cdf Prints details of Compound Document Files. compress Checks for, and looks inside, compressed files. csv Checks Comma Separated Value files. elf Prints ELF file details, provided soft magic tests are enabled and the elf magic is found. json Examines JSON (RFC-7159) files by parsing them for compliance. soft Consults magic files. simh Examines SIMH tape files. tar Examines tar files by verifying the checksum of the 512 byte tar header. Excluding this test can provide more detailed content description by using the soft magic method. text A synonym for ‘ascii’."
            },
            {
                "flag": "",
                "long": "--exclude-quiet",
                "arg": null,
                "description": "Like --exclude but ignore tests that file does not know about. This is intended for compatibility with older versions of file."
            },
            {
                "flag": "",
                "long": "--extension",
                "arg": null,
                "description": "Print a slash-separated list of valid extensions for the file type found."
            },
            {
                "flag": "-F",
                "long": "--separator",
                "arg": null,
                "description": "Use the specified string as the separator between the filename and the file result returned. Defaults to ‘:’."
            },
            {
                "flag": "-f",
                "long": "--files-from",
                "arg": null,
                "description": "Read the names of the files to be examined from namefile (one per line) before the argument list. Either namefile or at least one filename argument must be present; to test the standard input, use ‘-’ as a filename argument. Please note that namefile is unwrapped and the enclosed filenames are processed when this option is encountered and before any further options processing is done. This allows one to process multi‐ ple lists of files with different command line arguments on the same file invocation. Thus if you want to set the delimiter, you need to do it before you specify the list of files, like: “-F @ -f namefile”, instead of: “-f namefile -F @”."
            },
            {
                "flag": "-h",
                "long": "--no-dereference",
                "arg": null,
                "description": "This option causes symlinks not to be followed (on systems that support symbolic links). This is the default if the environment variable POSIXLYCORRECT is not de‐ fined."
            },
            {
                "flag": "-i",
                "long": "--mime",
                "arg": null,
                "description": "Causes the file command to output mime type strings rather than the more traditional human readable ones. Thus it may say ‘text/plain; charset=us-ascii’ rather than “ASCII text”. --mime-type, --mime-encoding Like -i, but print only the specified element(s)."
            },
            {
                "flag": "-k",
                "long": "--keep-going",
                "arg": null,
                "description": "Don't stop at the first match, keep going. Subsequent matches will be have the string ‘\\012- ’ prepended. (If you want a newline, see the -r option.) The magic pattern with the highest strength (see the -l option) comes first."
            },
            {
                "flag": "-l",
                "long": "--list",
                "arg": null,
                "description": "Shows a list of patterns and their strength sorted descending by magic(5) strength which is used for the matching (see also the -k option)."
            },
            {
                "flag": "-L",
                "long": "--dereference",
                "arg": null,
                "description": "This option causes symlinks to be followed, as the like-named option in ls(1) (on systems that support symbolic links). This is the default if the environment vari‐ able POSIXLYCORRECT is defined."
            },
            {
                "flag": "-m",
                "long": "--magic-file",
                "arg": null,
                "description": "Specify an alternate list of files and directories containing magic. This can be a single item, or a colon-separated list. If a compiled magic file is found alongside a file or directory, it will be used instead."
            },
            {
                "flag": "-N",
                "long": "--no-pad",
                "arg": null,
                "description": "Don't pad filenames so that they align in the output."
            },
            {
                "flag": "-n",
                "long": "--no-buffer",
                "arg": null,
                "description": "Force stdout to be flushed after checking each file. This is only useful if checking a list of files. It is intended to be used by programs that want filetype output from a pipe."
            },
            {
                "flag": "-p",
                "long": "--preserve-date",
                "arg": null,
                "description": "On systems that support utime(3) or utimes(2), attempt to preserve the access time of files analyzed, to pretend that file never read them."
            },
            {
                "flag": "-P",
                "long": "--parameter",
                "arg": null,
                "description": "Set various parameter limits. Name Default Explanation bytes 1M max number of bytes to read from file elfnotes 256 max ELF notes processed elfphnum 2K max ELF program sections processed elfshnum 32K max ELF sections processed elfshsize 128MB max ELF section size processed encoding 65K max number of bytes to determine encoding indir 50 recursion limit for indirect magic name 50 use count limit for name/use magic regex 8K length limit for regex searches"
            },
            {
                "flag": "-r",
                "long": "--raw",
                "arg": null,
                "description": "Don't translate unprintable characters to \\ooo. Normally file translates unprintable characters to their octal representation."
            },
            {
                "flag": "-s",
                "long": "--special-files",
                "arg": null,
                "description": "Normally, file only attempts to read and determine the type of argument files which stat(2) reports are ordinary files. This prevents problems, because reading special files may have peculiar consequences. Specifying the -s option causes file to also read argument files which are block or character special files. This is useful for determining the filesystem types of the data in raw disk partitions, which are block special files. This option also causes file to disregard the file size as reported by stat(2) since on some systems it reports a zero size for raw disk partitions."
            },
            {
                "flag": "-S",
                "long": "--no-sandbox",
                "arg": null,
                "description": "On systems where libseccomp (https://github.com/seccomp/libseccomp) is available, the -S option disables sandboxing which is enabled by default. This option is needed for file to execute external decompressing programs, i.e. when the -z option is specified and the built-in decompressors are not available. On systems where sandboxing is not available, this option has no effect. Note: This Debian version of file was built without seccomp support, so this option has no effect."
            },
            {
                "flag": "-v",
                "long": "--version",
                "arg": null,
                "description": "Print the version of the program and exit."
            },
            {
                "flag": "-z",
                "long": "--uncompress",
                "arg": null,
                "description": "Try to look inside compressed files."
            },
            {
                "flag": "-Z",
                "long": "--uncompress-noreport",
                "arg": null,
                "description": "Try to look inside compressed files, but report information about the contents only not the compression."
            },
            {
                "flag": "-0",
                "long": "--print0",
                "arg": null,
                "description": "Output a null character ‘\\0’ after the end of the filename. Nice to cut(1) the out‐ put. This does not affect the separator, which is still printed. If this option is repeated more than once, then file prints just the filename fol‐ lowed by a NUL followed by the description (or ERROR: text) followed by a second NUL for each entry. --help Print a help message and exit."
            }
        ],
        "examples": [
            "$ file file.c file /dev/{wd0a,hda}",
            "file.c:   C program text",
            "file:     ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV),",
            "dynamically linked (uses shared libs), stripped",
            "/dev/wd0a: block special (0/0)",
            "/dev/hda: block special (3/0)",
            "$ file -s /dev/wd0{b,d}",
            "/dev/wd0b: data",
            "/dev/wd0d: x86 boot sector",
            "$ file -s /dev/hda{,1,2,3,4,5,6,7,8,9,10}",
            "/dev/hda:   x86 boot sector",
            "/dev/hda1:  Linux/i386 ext2 filesystem",
            "/dev/hda2:  x86 boot sector",
            "/dev/hda3:  x86 boot sector, extended partition table",
            "/dev/hda4:  Linux/i386 ext2 filesystem",
            "/dev/hda5:  Linux/i386 swap file",
            "/dev/hda6:  Linux/i386 swap file",
            "/dev/hda7:  Linux/i386 swap file",
            "/dev/hda8:  Linux/i386 swap file",
            "/dev/hda9:  empty",
            "/dev/hda10: empty",
            "$ file -i file.c file /dev/{wd0a,hda}",
            "file.c:      text/x-c",
            "file:        application/x-executable",
            "/dev/hda:    application/x-not-regular-file",
            "/dev/wd0a:   application/x-not-regular-file"
        ],
        "see_also": [
            {
                "name": "hexdump",
                "section": "1",
                "url": "https://www.chedong.com/phpMan.php/man/hexdump/1/json"
            },
            {
                "name": "od",
                "section": "1",
                "url": "https://www.chedong.com/phpMan.php/man/od/1/json"
            },
            {
                "name": "strings",
                "section": "1",
                "url": "https://www.chedong.com/phpMan.php/man/strings/1/json"
            },
            {
                "name": "magic",
                "section": "5",
                "url": "https://www.chedong.com/phpMan.php/man/magic/5/json"
            }
        ],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 6,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 59,
                "subsections": []
            },
            {
                "name": "OPTIONS",
                "lines": 1,
                "subsections": [
                    {
                        "name": "--apple",
                        "lines": 5,
                        "long": "--apple"
                    },
                    {
                        "name": "-b --brief",
                        "lines": 2,
                        "flag": "-b",
                        "long": "--brief"
                    },
                    {
                        "name": "-C --compile",
                        "lines": 3,
                        "flag": "-C",
                        "long": "--compile"
                    },
                    {
                        "name": "-c --checking-printout",
                        "lines": 3,
                        "flag": "-c",
                        "long": "--checking-printout"
                    },
                    {
                        "name": "-d",
                        "lines": 1,
                        "flag": "-d"
                    },
                    {
                        "name": "-E",
                        "lines": 2,
                        "flag": "-E"
                    },
                    {
                        "name": "-e --exclude _",
                        "lines": 33,
                        "flag": "-e",
                        "long": "--exclude"
                    },
                    {
                        "name": "--exclude-quiet",
                        "lines": 3,
                        "long": "--exclude-quiet"
                    },
                    {
                        "name": "--extension",
                        "lines": 2,
                        "long": "--extension"
                    },
                    {
                        "name": "-F --separator _",
                        "lines": 3,
                        "flag": "-F",
                        "long": "--separator"
                    },
                    {
                        "name": "-f --files-from _",
                        "lines": 9,
                        "flag": "-f",
                        "long": "--files-from"
                    },
                    {
                        "name": "-h --no-dereference",
                        "lines": 4,
                        "flag": "-h",
                        "long": "--no-dereference"
                    },
                    {
                        "name": "-i --mime",
                        "lines": 7,
                        "flag": "-i",
                        "long": "--mime"
                    },
                    {
                        "name": "-k --keep-going",
                        "lines": 4,
                        "flag": "-k",
                        "long": "--keep-going"
                    },
                    {
                        "name": "-l --list",
                        "lines": 3,
                        "flag": "-l",
                        "long": "--list"
                    },
                    {
                        "name": "-L --dereference",
                        "lines": 4,
                        "flag": "-L",
                        "long": "--dereference"
                    },
                    {
                        "name": "-m --magic-file _",
                        "lines": 4,
                        "flag": "-m",
                        "long": "--magic-file"
                    },
                    {
                        "name": "-N --no-pad",
                        "lines": 2,
                        "flag": "-N",
                        "long": "--no-pad"
                    },
                    {
                        "name": "-n --no-buffer",
                        "lines": 4,
                        "flag": "-n",
                        "long": "--no-buffer"
                    },
                    {
                        "name": "-p --preserve-date",
                        "lines": 3,
                        "flag": "-p",
                        "long": "--preserve-date"
                    },
                    {
                        "name": "-P --parameter _",
                        "lines": 13,
                        "flag": "-P",
                        "long": "--parameter"
                    },
                    {
                        "name": "-r --raw",
                        "lines": 3,
                        "flag": "-r",
                        "long": "--raw"
                    },
                    {
                        "name": "-s --special-files",
                        "lines": 8,
                        "flag": "-s",
                        "long": "--special-files"
                    },
                    {
                        "name": "-S --no-sandbox",
                        "lines": 9,
                        "flag": "-S",
                        "long": "--no-sandbox"
                    },
                    {
                        "name": "-v --version",
                        "lines": 2,
                        "flag": "-v",
                        "long": "--version"
                    },
                    {
                        "name": "-z --uncompress",
                        "lines": 2,
                        "flag": "-z",
                        "long": "--uncompress"
                    },
                    {
                        "name": "-Z --uncompress-noreport",
                        "lines": 3,
                        "flag": "-Z",
                        "long": "--uncompress-noreport"
                    },
                    {
                        "name": "-0 --print0",
                        "lines": 9,
                        "flag": "-0",
                        "long": "--print0"
                    }
                ]
            },
            {
                "name": "ENVIRONMENT",
                "lines": 5,
                "subsections": [
                    {
                        "name": "-h",
                        "lines": 1,
                        "flag": "-h"
                    }
                ]
            },
            {
                "name": "FILES",
                "lines": 3,
                "subsections": []
            },
            {
                "name": "EXIT STATUS",
                "lines": 7,
                "subsections": []
            },
            {
                "name": "EXAMPLES",
                "lines": 31,
                "subsections": []
            },
            {
                "name": "SEE ALSO",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "STANDARDS CONFORMANCE",
                "lines": 30,
                "subsections": []
            },
            {
                "name": "SECURITY",
                "lines": 6,
                "subsections": []
            },
            {
                "name": "MAGIC DIRECTORY",
                "lines": 8,
                "subsections": []
            },
            {
                "name": "HISTORY",
                "lines": 30,
                "subsections": []
            },
            {
                "name": "LEGAL NOTICE",
                "lines": 6,
                "subsections": []
            },
            {
                "name": "BUGS",
                "lines": 4,
                "subsections": []
            },
            {
                "name": "TODO",
                "lines": 48,
                "subsections": []
            },
            {
                "name": "AVAILABILITY",
                "lines": 4,
                "subsections": []
            }
        ],
        "sections": {
            "NAME": {
                "content": "file — determine file type\n",
                "subsections": []
            },
            "SYNOPSIS": {
                "content": "file   [-bcdEhiklLNnprsSvzZ0]  [--apple]  [--exclude-quiet]  [--extension]  [--mime-encoding]\n[--mime-type] [-e testname] [-F separator] [-f namefile] [-m magicfiles] [-P name=value]\nfile ...\nfile -C [-m magicfiles]\nfile [--help]\n",
                "subsections": []
            },
            "DESCRIPTION": {
                "content": "This manual page documents version 5.45 of the file command.\n\nfile tests each argument in an attempt to classify it.  There are three sets of  tests,  per‐\nformed in this order: filesystem tests, magic tests, and language tests.  The first test that\nsucceeds causes the file type to be printed.\n\nThe  type printed will usually contain one of the words text (the file contains only printing\ncharacters and a few common control characters and is probably safe to read on an ASCII  ter‐\nminal), executable (the file contains the result of compiling a program in a form understand‐\nable to some UNIX kernel or another), or data meaning anything else (data is usually “binary”\nor  non-printable).   Exceptions  are well-known file formats (core files, tar archives) that\nare known to contain binary data.  When modifying magic files or  the  program  itself,  make\nsure  to  preserve  these keywords.  Users depend on knowing that all the readable files in a\ndirectory have the word “text” printed.  Don't do as Berkeley did and change “shell  commands\ntext” to “shell script”.\n\nThe  filesystem tests are based on examining the return from a stat(2) system call.  The pro‐\ngram checks to see if the file is empty, or if it's some sort of  special  file.   Any  known\nfile  types  appropriate  to the system you are running on (sockets, symbolic links, or named\npipes (FIFOs) on those systems that implement them) are intuited if they are defined  in  the\nsystem header file <sys/stat.h>.\n\nThe  magic  tests  are  used  to  check for files with data in particular fixed formats.  The\ncanonical example of this is a binary executable (compiled program) a.out file, whose  format\nis  defined  in  <elf.h>,  <a.out.h> and possibly <exec.h> in the standard include directory.\nThese files have a “magic number” stored in a particular place near the beginning of the file\nthat tells the UNIX operating system that the file is a binary executable, and which of  sev‐\neral  types  thereof.   The concept of a “magic number” has been applied by extension to data\nfiles.  Any file with some invariant identifier at a small fixed offset  into  the  file  can\nusually  be  described  in  this  way.   The information identifying these files is read from\n/etc/magic and the compiled magic file /usr/share/misc/magic.mgc, or the files in the  direc‐\ntory   /usr/share/misc/magic   if  the  compiled  file  does  not  exist.   In  addition,  if\n$HOME/.magic.mgc or $HOME/.magic exists, it will be used in preference to  the  system  magic\nfiles.\n\nIf  a  file  does not match any of the entries in the magic file, it is examined to see if it\nseems to be a text file.  ASCII, ISO-8859-x,  non-ISO  8-bit  extended-ASCII  character  sets\n(such  as  those used on Macintosh and IBM PC systems), UTF-8-encoded Unicode, UTF-16-encoded\nUnicode, and EBCDIC character sets can be distinguished by the different ranges and sequences\nof bytes that constitute printable text in each set.  If a file passes any  of  these  tests,\nits  character set is reported.  ASCII, ISO-8859-x, UTF-8, and extended-ASCII files are iden‐\ntified as “text” because they will be mostly readable on  nearly  any  terminal;  UTF-16  and\nEBCDIC  are  only “character data” because, while they contain text, it is text that will re‐\nquire translation before it can be read.  In addition, file will attempt to  determine  other\ncharacteristics  of  text-type  files.  If the lines of a file are terminated by CR, CRLF, or\nNEL, instead of the Unix-standard LF, this will be reported.  Files that contain embedded es‐\ncape sequences or overstriking will also be identified.\n\nOnce file has determined the character set used in a text-type file, it will attempt  to  de‐\ntermine in what language the file is written.  The language tests look for particular strings\n(cf.   <names.h>)  that  can appear anywhere in the first few blocks of a file.  For example,\nthe keyword .br indicates that the file is most likely a troff(1) input  file,  just  as  the\nkeyword  struct  indicates  a C program.  These tests are less reliable than the previous two\ngroups, so they are performed last.  The language test routines also test for some miscellany\n(such as tar(1) archives, JSON files).\n\nAny file that cannot be identified as having been written in any of the character sets listed\nabove is simply said to be “data”.\n",
                "subsections": []
            },
            "OPTIONS": {
                "content": "",
                "subsections": [
                    {
                        "name": "--apple",
                        "content": "Causes the file command to output the file type and creator code as used by older Ma‐\ncOS versions.  The code consists of eight letters,  the  first  describing  the  file\ntype,  the latter the creator.  This option works properly only for file formats that\nhave the apple-style output defined.\n",
                        "long": "--apple"
                    },
                    {
                        "name": "-b --brief",
                        "content": "Do not prepend filenames to output lines (brief mode).\n",
                        "flag": "-b",
                        "long": "--brief"
                    },
                    {
                        "name": "-C --compile",
                        "content": "Write a magic.mgc output file that contains a pre-parsed version of the magic file or\ndirectory.\n",
                        "flag": "-C",
                        "long": "--compile"
                    },
                    {
                        "name": "-c --checking-printout",
                        "content": "Cause a checking printout of the parsed form of the magic file.  This is usually used\nin conjunction with the -m option to debug a new magic file before installing it.\n",
                        "flag": "-c",
                        "long": "--checking-printout"
                    },
                    {
                        "name": "-d",
                        "content": "",
                        "flag": "-d"
                    },
                    {
                        "name": "-E",
                        "content": "output as POSIX mandates and keep going, issue an error message and exit.\n",
                        "flag": "-E"
                    },
                    {
                        "name": "-e --exclude _",
                        "content": "Exclude  the test named in testname from the list of tests made to determine the file\ntype.  Valid test names are:\n\napptype   EMX application type (only on EMX).\n\nascii     Various types of text files (this test will try to guess the text encoding,\nirrespective of the setting of the ‘encoding’ option).\n\nencoding  Different text encodings for soft magic tests.\n\ntokens    Ignored for backwards compatibility.\n\ncdf       Prints details of Compound Document Files.\n\ncompress  Checks for, and looks inside, compressed files.\n\ncsv       Checks Comma Separated Value files.\n\nelf       Prints ELF file details, provided soft magic tests are enabled and the  elf\nmagic is found.\n\njson      Examines JSON (RFC-7159) files by parsing them for compliance.\n\nsoft      Consults magic files.\n\nsimh      Examines SIMH tape files.\n\ntar       Examines  tar  files  by verifying the checksum of the 512 byte tar header.\nExcluding this test can provide more detailed content description by  using\nthe soft magic method.\n\ntext      A synonym for ‘ascii’.\n",
                        "flag": "-e",
                        "long": "--exclude"
                    },
                    {
                        "name": "--exclude-quiet",
                        "content": "Like  --exclude but ignore tests that file does not know about.  This is intended for\ncompatibility with older versions of file.\n",
                        "long": "--exclude-quiet"
                    },
                    {
                        "name": "--extension",
                        "content": "Print a slash-separated list of valid extensions for the file type found.\n",
                        "long": "--extension"
                    },
                    {
                        "name": "-F --separator _",
                        "content": "Use the specified string as the separator between the filename and  the  file  result\nreturned.  Defaults to ‘:’.\n",
                        "flag": "-F",
                        "long": "--separator"
                    },
                    {
                        "name": "-f --files-from _",
                        "content": "Read  the  names  of the files to be examined from namefile (one per line) before the\nargument list.  Either namefile or at least one filename argument must be present; to\ntest the standard input, use ‘-’ as a filename argument.  Please note  that  namefile\nis unwrapped and the enclosed filenames are processed when this option is encountered\nand before any further options processing is done.  This allows one to process multi‐\nple lists of files with different command line arguments on the same file invocation.\nThus  if you want to set the delimiter, you need to do it before you specify the list\nof files, like: “-F @ -f namefile”, instead of: “-f namefile -F @”.\n",
                        "flag": "-f",
                        "long": "--files-from"
                    },
                    {
                        "name": "-h --no-dereference",
                        "content": "This option causes symlinks not to be followed  (on  systems  that  support  symbolic\nlinks).   This  is the default if the environment variable POSIXLYCORRECT is not de‐\nfined.\n",
                        "flag": "-h",
                        "long": "--no-dereference"
                    },
                    {
                        "name": "-i --mime",
                        "content": "Causes the file command to output mime type strings rather than the more  traditional\nhuman  readable  ones.   Thus  it  may say ‘text/plain; charset=us-ascii’ rather than\n“ASCII text”.\n\n--mime-type, --mime-encoding\nLike -i, but print only the specified element(s).\n",
                        "flag": "-i",
                        "long": "--mime"
                    },
                    {
                        "name": "-k --keep-going",
                        "content": "Don't stop at the first match, keep going.   Subsequent  matches  will  be  have  the\nstring  ‘\\012-  ’  prepended.  (If you want a newline, see the -r option.)  The magic\npattern with the highest strength (see the -l option) comes first.\n",
                        "flag": "-k",
                        "long": "--keep-going"
                    },
                    {
                        "name": "-l --list",
                        "content": "Shows a list of patterns and their strength sorted descending  by  magic(5)  strength\nwhich is used for the matching (see also the -k option).\n",
                        "flag": "-l",
                        "long": "--list"
                    },
                    {
                        "name": "-L --dereference",
                        "content": "This  option  causes  symlinks  to be followed, as the like-named option in ls(1) (on\nsystems that support symbolic links).  This is the default if the  environment  vari‐\nable POSIXLYCORRECT is defined.\n",
                        "flag": "-L",
                        "long": "--dereference"
                    },
                    {
                        "name": "-m --magic-file _",
                        "content": "Specify  an  alternate list of files and directories containing magic.  This can be a\nsingle item, or a colon-separated list.  If a compiled magic file is found  alongside\na file or directory, it will be used instead.\n",
                        "flag": "-m",
                        "long": "--magic-file"
                    },
                    {
                        "name": "-N --no-pad",
                        "content": "Don't pad filenames so that they align in the output.\n",
                        "flag": "-N",
                        "long": "--no-pad"
                    },
                    {
                        "name": "-n --no-buffer",
                        "content": "Force stdout to be flushed after checking each file.  This is only useful if checking\na  list  of  files.   It is intended to be used by programs that want filetype output\nfrom a pipe.\n",
                        "flag": "-n",
                        "long": "--no-buffer"
                    },
                    {
                        "name": "-p --preserve-date",
                        "content": "On systems that support utime(3) or utimes(2), attempt to preserve the access time of\nfiles analyzed, to pretend that file never read them.\n",
                        "flag": "-p",
                        "long": "--preserve-date"
                    },
                    {
                        "name": "-P --parameter _",
                        "content": "Set various parameter limits.\n\nName         Default    Explanation\nbytes        1M         max number of bytes to read from file\nelfnotes    256        max ELF notes processed\nelfphnum    2K         max ELF program sections processed\nelfshnum    32K        max ELF sections processed\nelfshsize   128MB      max ELF section size processed\nencoding     65K        max number of bytes to determine encoding\nindir        50         recursion limit for indirect magic\nname         50         use count limit for name/use magic\nregex        8K         length limit for regex searches\n",
                        "flag": "-P",
                        "long": "--parameter"
                    },
                    {
                        "name": "-r --raw",
                        "content": "Don't translate unprintable characters to \\ooo.  Normally file translates unprintable\ncharacters to their octal representation.\n",
                        "flag": "-r",
                        "long": "--raw"
                    },
                    {
                        "name": "-s --special-files",
                        "content": "Normally, file only attempts to read and determine the type of argument  files  which\nstat(2)  reports are ordinary files.  This prevents problems, because reading special\nfiles may have peculiar consequences.  Specifying the -s option causes file  to  also\nread  argument  files which are block or character special files.  This is useful for\ndetermining the filesystem types of the data in raw disk partitions, which are  block\nspecial  files.   This option also causes file to disregard the file size as reported\nby stat(2) since on some systems it reports a zero size for raw disk partitions.\n",
                        "flag": "-s",
                        "long": "--special-files"
                    },
                    {
                        "name": "-S --no-sandbox",
                        "content": "On systems where libseccomp (https://github.com/seccomp/libseccomp) is available, the\n-S option disables sandboxing which is enabled by default.  This option is needed for\nfile to execute external decompressing programs, i.e. when the -z option is specified\nand the built-in decompressors are not available.  On systems where sandboxing is not\navailable, this option has no effect.\n\nNote: This Debian version of file was built without seccomp support, so  this  option\nhas no effect.\n",
                        "flag": "-S",
                        "long": "--no-sandbox"
                    },
                    {
                        "name": "-v --version",
                        "content": "Print the version of the program and exit.\n",
                        "flag": "-v",
                        "long": "--version"
                    },
                    {
                        "name": "-z --uncompress",
                        "content": "Try to look inside compressed files.\n",
                        "flag": "-z",
                        "long": "--uncompress"
                    },
                    {
                        "name": "-Z --uncompress-noreport",
                        "content": "Try  to  look inside compressed files, but report information about the contents only\nnot the compression.\n",
                        "flag": "-Z",
                        "long": "--uncompress-noreport"
                    },
                    {
                        "name": "-0 --print0",
                        "content": "Output a null character ‘\\0’ after the end of the filename.  Nice to cut(1) the  out‐\nput.  This does not affect the separator, which is still printed.\n\nIf  this  option  is repeated more than once, then file prints just the filename fol‐\nlowed by a NUL followed by the description (or ERROR: text) followed by a second  NUL\nfor each entry.\n\n--help  Print a help message and exit.\n",
                        "flag": "-0",
                        "long": "--print0"
                    }
                ]
            },
            "ENVIRONMENT": {
                "content": "The environment variable MAGIC can be used to set the default magic file name.  If that vari‐\nable  is set, then file will not attempt to open $HOME/.magic.  file adds “.mgc” to the value\nof this variable as appropriate.  The environment variable POSIXLYCORRECT controls (on  sys‐\ntems  that  support symbolic links), whether file will attempt to follow symlinks or not.  If\nset, then file follows symlink, otherwise it does not.  This is also controlled by the -L and",
                "subsections": [
                    {
                        "name": "-h",
                        "content": "",
                        "flag": "-h"
                    }
                ]
            },
            "FILES": {
                "content": "/usr/share/misc/magic.mgc  Default compiled list of magic.\n/usr/share/misc/magic      Directory containing default magic files.\n",
                "subsections": []
            },
            "EXIT STATUS": {
                "content": "file will exit with 0 if the operation was successful or >0 if an error was encountered.  The\nfollowing errors cause diagnostic messages, but don't affect the program exit code (as  POSIX\nrequires), unless -E is specified:\n•   A file cannot be found\n•   There is no permission to read a file\n•   The file type cannot be determined\n",
                "subsections": []
            },
            "EXAMPLES": {
                "content": "$ file file.c file /dev/{wd0a,hda}\nfile.c:   C program text\nfile:     ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV),\ndynamically linked (uses shared libs), stripped\n/dev/wd0a: block special (0/0)\n/dev/hda: block special (3/0)\n\n$ file -s /dev/wd0{b,d}\n/dev/wd0b: data\n/dev/wd0d: x86 boot sector\n\n$ file -s /dev/hda{,1,2,3,4,5,6,7,8,9,10}\n/dev/hda:   x86 boot sector\n/dev/hda1:  Linux/i386 ext2 filesystem\n/dev/hda2:  x86 boot sector\n/dev/hda3:  x86 boot sector, extended partition table\n/dev/hda4:  Linux/i386 ext2 filesystem\n/dev/hda5:  Linux/i386 swap file\n/dev/hda6:  Linux/i386 swap file\n/dev/hda7:  Linux/i386 swap file\n/dev/hda8:  Linux/i386 swap file\n/dev/hda9:  empty\n/dev/hda10: empty\n\n$ file -i file.c file /dev/{wd0a,hda}\nfile.c:      text/x-c\nfile:        application/x-executable\n/dev/hda:    application/x-not-regular-file\n/dev/wd0a:   application/x-not-regular-file\n\n",
                "subsections": []
            },
            "SEE ALSO": {
                "content": "hexdump(1), od(1), strings(1), magic(5)\n",
                "subsections": []
            },
            "STANDARDS CONFORMANCE": {
                "content": "This program is believed to exceed the System V Interface Definition of FILE(CMD), as near as\none can determine from the vague language contained therein.  Its behavior is mostly compati‐\nble  with  the System V program of the same name.  This version knows more magic, however, so\nit will produce different (albeit more accurate) output in many cases.\n\nThe one significant difference between this version and System V is that this version  treats\nany white space as a delimiter, so that spaces in pattern strings must be escaped.  For exam‐\nple,\n\n>10     string  language impress        (imPRESS data)\n\nin an existing magic file would have to be changed to\n\n>10     string  language\\ impress       (imPRESS data)\n\nIn  addition,  in this version, if a pattern string contains a backslash, it must be escaped.\nFor example\n\n0       string          \\begindata      Andrew Toolkit document\n\nin an existing magic file would have to be changed to\n\n0       string          \\\\begindata     Andrew Toolkit document\n\nSunOS releases 3.2 and later from Sun Microsystems include a file command  derived  from  the\nSystem  V one, but with some extensions.  This version differs from Sun's only in minor ways.\nIt includes the extension of the ‘&’ operator, used as, for example,\n\n>16     long&0x7fffffff >0              not stripped\n",
                "subsections": []
            },
            "SECURITY": {
                "content": "On systems where libseccomp (https://github.com/seccomp/libseccomp) is available, file is en‐\nforces limiting system calls to only the ones necessary for the  operation  of  the  program.\nThis enforcement does not provide any security benefit when file is asked to decompress input\nfiles  running  external programs with the -z option.  To enable execution of external decom‐\npressors, one needs to disable sandboxing using the -S option.\n",
                "subsections": []
            },
            "MAGIC DIRECTORY": {
                "content": "The magic file entries have been collected from various  sources,  mainly  USENET,  and  con‐\ntributed by various authors.  Christos Zoulas (address below) will collect additional or cor‐\nrected magic file entries.  A consolidation of magic file entries will be distributed period‐\nically.\n\nThe  order of entries in the magic file is significant.  Depending on what system you are us‐\ning, the order that they are put together may be incorrect.\n",
                "subsections": []
            },
            "HISTORY": {
                "content": "There has been a file command in every UNIX since at least Research Version 4 (man page dated\nNovember, 1973).  The System V version introduced one significant major change: the  external\nlist of magic types.  This slowed the program down slightly but made it a lot more flexible.\n\nThis  program,  based  on the System V version, was written by Ian Darwin ⟨ian@darwinsys.com⟩\nwithout looking at anybody else's source code.\n\nJohn Gilmore revised the code extensively, making it better than the  first  version.   Geoff\nCollyer  found  several  inadequacies and provided some magic file entries.  Contributions of\nthe ‘&’ operator by Rob McMahon, ⟨cudcv@warwick.ac.uk⟩, 1989.\n\nGuy Harris, ⟨guy@netapp.com⟩, made many changes from 1993 to the present.\n\nPrimary  development  and  maintenance  from  1990  to  the  present   by   Christos   Zoulas\n⟨christos@astron.com⟩.\n\nAltered  by  Chris  Lowth  ⟨chris@lowth.com⟩,  2000: handle the -i option to output mime type\nstrings, using an alternative magic file and internal logic.\n\nAltered by Eric Fischer ⟨enf@pobox.com⟩, July, 2000, to identify character codes and  attempt\nto identify the languages of non-ASCII files.\n\nAltered  by  Reuben Thomas ⟨rrt@sc3d.org⟩, 2007-2011, to improve MIME support, merge MIME and\nnon-MIME magic, support directories as well as files of magic, apply many bug  fixes,  update\nand  fix a lot of magic, improve the build system, improve the documentation, and rewrite the\nPython bindings in pure Python.\n\nThe list of contributors to the ‘magic’ directory (magic files) is too long to include  here.\nYou know who you are; thank you.  Many contributors are listed in the source files.\n",
                "subsections": []
            },
            "LEGAL NOTICE": {
                "content": "Copyright  (c)  Ian  F. Darwin, Toronto, Canada, 1986-1999.  Covered by the standard Berkeley\nSoftware Distribution copyright; see the file COPYING in the source distribution.\n\nThe files tar.h and istar.c were written by John Gilmore from his public-domain tar(1)  pro‐\ngram, and are not covered by the above license.\n",
                "subsections": []
            },
            "BUGS": {
                "content": "Please  report  bugs  and  send patches to the bug tracker at https://bugs.astron.com/ or the\nmailing list  at  ⟨file@astron.com⟩  (visit  https://mailman.astron.com/mailman/listinfo/file\nfirst to subscribe).\n",
                "subsections": []
            },
            "TODO": {
                "content": "Fix  output so that tests for MIME and APPLE flags are not needed all over the place, and ac‐\ntual output is only done in one place.  This needs a design.  Suggestion: push possible  out‐\nputs  on to a list, then pick the last-pushed (most specific, one hopes) value at the end, or\nuse a default if the list is empty.  This should not slow down evaluation.\n\nThe handling of MAGICCONTINUE and printing \\012- between entries is clumsy and  complicated;\nrefactor and centralize.\n\nSome of the encoding logic is hard-coded in encoding.c and can be moved to the magic files if\nwe had a !:charset annotation.\n\nContinue to squash all magic bugs.  See Debian BTS for a good source.\n\nStore arbitrarily long strings, for example for %s patterns, so that they can be printed out.\nFixes  Debian  bug #271672.  This can be done by allocating strings in a string pool, storing\nthe string pool at the end of the magic file and converting all the string pointers to  rela‐\ntive offsets from the string pool.\n\nAdd syntax for relative offsets after current level (Debian bug #466037).\n\nMake file -ki work, i.e. give multiple MIME types.\n\nAdd  a  zip  library  so  we can peek inside Office2007 documents to print more details about\ntheir contents.\n\nAdd an option to print URLs for the sources of the file descriptions.\n\nCombine script searches and add a way to map executable names to  MIME  types  (e.g.  have  a\nmagic  value  for !:mime which causes the resulting string to be looked up in a table).  This\nwould avoid adding the same magic repeatedly for each new hash-bang interpreter.\n\nWhen a file descriptor is available, we can skip and adjust the buffer instead of  the  hacky\nbuffer management we do now.\n\nFix “name” and “use” to check for consistency at compile time (duplicate “name”, “use” point‐\ning  to  undefined  “name” ).  Make “name” / “use” more efficient by keeping a sorted list of\nnames.  Special-case ^ to flip endianness in the parser so that it does not have  to  be  es‐\ncaped, and document it.\n\nIf  the offsets specified internally in the file exceed the buffer size ( HOWMANY variable in\nfile.h), then we don't seek to that offset, but we give up.  It would  be  better  if  buffer\nmanagements  was  done  when the file descriptor is available so we can seek around the file.\nOne must be careful though because this has performance and thus security considerations, be‐\ncause one can slow down things by repeatedly seeking.\n\nThere is support now for keeping separate buffers and having offsets  from  the  end  of  the\nfile, but the internal buffer management still needs an overhaul.\n",
                "subsections": []
            },
            "AVAILABILITY": {
                "content": "You can obtain the original author's latest version by anonymous FTP on ftp.astron.com in the\ndirectory /pub/file/file-X.YZ.tar.gz.\n\nDebian                                      May 21, 2023                                     FILE(1)",
                "subsections": []
            }
        }
    }
}