file
file managementLinux/Unix
The file command is one of the most frequently used commands in Linux/Unix-like operating systems. file Determine file type
Quick Reference
Command Name:
file
Category:
file management
Platform:
Linux/Unix
Basic Usage:
file [options] [arguments]
Common Use Cases
Syntax
file [options] [file...]
Options
Option | Description |
---|---|
-b, --brief |
Do not prepend filenames to output lines |
-c, --checking-printout |
Print the parsed form of the magic file for debugging |
-f, --files-from FILE |
Read the names of the files to be examined from FILE |
-F, --separator STRING |
Use STRING as the separator between file name and file result |
-i, --mime |
Output MIME type strings rather than traditional descriptions |
-k, --keep-going |
Continue looking for matches after finding a match |
-L, --dereference |
Follow symbolic links |
-m, --magic-file LIST |
Use LIST as a colon-separated list of magic files |
-n, --no-buffer |
Do not buffer output |
-z, --uncompress |
Try to look inside compressed files |
Examples
How to Use These Examples
The examples below show common ways to use the file
command. Try them in your terminal to see the results. You can copy any example by clicking on the code block.
# Basic Examples Basic
file document.txt