A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://www.geeksforgeeks.org/linux-unix/file-command-in-linux-with-examples/ below:

file command in Linux with examples

file command in Linux with examples

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 Works

It has three sets of tests as follows:

Syntax
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'
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'
Commonly Used Options with 'file' Command

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