file flags & options
Basic usage
Identify a file's type by examining its contents.
file image.png
file mystery_binary
-i, --mime
Output the MIME type instead of a human-readable description.
file -i document.pdf
-b, --brief
Omit the filename from output. Just print the type.
file -b data.csv
-z
Look inside compressed files.
file -z archive.gz
-L, --dereference
Follow symbolic links and report the target's type.
file -L /usr/bin/python
-f, --files-from
Read filenames from a list file.
file -f filelist.txt
-k, --keep-going
Don't stop at the first match — show all possible types.
file -k ambiguous_file
-s, --special-files
Read block or character special files (devices).
file -s /dev/sda1
Multiple files
Pass multiple files at once.
file *.jpg *.png *.gif