Installation Instructions
# Using Chocolatey
choco install file
# Using MSYS2
pacman -S file
# Debian/Ubuntu
sudo apt-get install file
# RHEL/CentOS
sudo yum install file
# Arch Linux
sudo pacman -S file
# Usually pre-installed, if not:
brew install file
Basic file identification:
Don't follow symlinks:
Show mime type:
file --mime-type filename
Process multiple files:
Process entire directory:
Recursive file analysis:
Brief mode:
No filename in output:
Detailed mime type:
Analyze compressed file:
Look inside ZIP files:
Examine device files:
Show ELF details:
Check for stripped binaries:
file binary | grep stripped
Display architecture:
file binary | grep -o " .*bit"
Use specific magic file:
file -m /path/to/magic filename
Show magic file compilation:
Debug magic file compilation:
file --debug-magic filename
Examine URLs:
file -L http://example.com/file
Follow symbolic links:
Preserve file times:
Show file version info:
Check magic file syntax:
Check for malformed files:
Analyze raw data:
Examine filesystem type:
Show partition info:
Look inside tar files:
Examine ISO images:
Check text encoding:
Show line endings:
file -k textfile | grep -o " text.*"
Separator string:
Custom output format:
Analyze core dumps:
Examine memory dumps:
No pad option:
Fast mode:
Generate machine-readable output:
Print magic database:
Show supported filesystems:
Display compilation options:
file -v | grep " compiled"
Check for scripts:
file --keep-going script.sh
Analyze symbolic links:
No buffering:
file --no-buffer filename
Raw output mode:
Continue after errors:
file --keep-going filename
Show error details:
Test magic patterns:
file -M magic_file filename
Compile magic file:
Check magic syntax: