Documentation

Alternatives to popular CLI tools: file

file determines the type of data contained in a file by examining its contents rather than relying on filename extensions. It is commonly used to identify unknown files, verify file formats, and diagnose issues with corrupted or misnamed files.

The command analyses files using several tests and a database of “magic numbers” that correspond to known file signatures and formats.

This is free and open source software.

Key Features

  • Determines the type of a file by examining its contents rather than relying on filename extensions.
  • Uses a database of magic numbers to recognise hundreds of file formats.
  • Identifies file categories such as text files, executables, images, archives, and multimedia files.
  • Performs multiple checks including filesystem tests and pattern matching.
  • Can output MIME types suitable for scripts and automation.
  • Works with regular files, directories, symbolic links, and special files.

file man page

Alternatives to file
filUnix file command written in Go
mimetypeDetermines the MIME type of files
xdg-mimePart of xdg-utils
TrIDIdentify file types from their binary signatures
binwalkSearch a given binary image for embedded files

All the CLI tools in this series.

Alternatives to CLI tools
age // awk // bc // cal // cat // cd // chmod // cksum // cloc // cmp // compress // cp // cron // curl // cut // date // dd // df // diff // dig // du // fdisk // file // find // free // ftp // grep // gzip // hexdump // history // jq // kill // less // locate // ls // lsof // make // man // more // mv / ping // ps // psql // rename // rm // sed // split // ssh // stow // strings // sudo // sysctl // tail // talk // tar // telnet // time // top // touch // traceroute // tree // uname // uniq // uptime // vi // watch // Wget // who // whois // xargs

Best Free and Open Source Software Explore our carefully curated directory of recommended free and open source software, covering every major software category.

The directory forms part of our extensive collection of articles for Linux enthusiasts. It includes hundreds of detailed reviews, together with free and open source alternatives to proprietary software from companies such as Google, Microsoft, Apple, Adobe, IBM, Cisco, Oracle, and Autodesk.

LinuxLinks also covers interesting projects worth exploring, Linux-compatible hardware, free programming books and tutorials, and much more.

Know a useful free and open source Linux application that we haven’t covered? Tell us about it using our submission form.
Subscribe

Please read our Comment Policy before commenting.

Notify of
guest
0 Comments
Oldest
Newest Most Voted