Last Updated : 11 Jul, 2025
The 'file' command in Linux is a vital utility for determining the type of a file. It identifies file types by examining their content rather than their file extensions, making it an indispensable tool for users who work with various file formats. The file type can be displayed in a human-readable format (e.g., ASCII text) or as a MIME type (e.g., 'text/plain; charset=us-ascii'). The file command tests each argument provided to categorize it accurately.
How the 'file' Command WorksIt has three sets of tests as follows:
file [option] [filename]Example of 'file' Command
You can use the 'file' command with various files to determine their types:
file email.py # Displays type of 'email.py'Commonly Used Options with 'file' Command
file name.jpeg # Displays type of 'name.jpeg'
file Invoice.pdf # Displays type of 'Invoice.pdf'
file exam.ods # Displays type of 'exam.ods'
file videosong.mp4 # Displays type of 'videosong.mp4'
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4