Skip to content

Linux file Guide

Mattscreative edited this page Dec 5, 2025 · 3 revisions

Linux file Guide

Complete beginner-friendly guide to file on Linux, covering Arch Linux, CachyOS, and other distributions including file type detection, MIME type identification, and file classification.


Table of Contents

  1. file Basics
  2. File Type Detection
  3. MIME Types
  4. Multiple Files
  5. Troubleshooting

file Basics

Detect File Type

Basic usage:

# Detect file type
file file.txt

# Output: file.txt: ASCII text

Unknown File

Identify unknown:

# Identify unknown file
file unknown.bin

# Attempts to identify file type

File Type Detection

Text Files

Text detection:

# Text file
file document.txt

# Output: ASCII text

Binary Files

Binary detection:

# Binary file
file program.bin

# Output: ELF 64-bit LSB executable

MIME Types

MIME Output

MIME type:

# MIME type
file --mime-type file.txt

# Output: text/plain

MIME Encoding

MIME encoding:

# MIME encoding
file --mime-encoding file.txt

# Output: us-ascii

Multiple Files

Multiple Files

Multiple detection:

# Multiple files
file file1.txt file2.bin

# Shows type for each file

Recursive

Directory scan:

# Recursive scan
file -r directory/

# -r = recursive (scans directory)

Troubleshooting

file Not Found

Check installation:

# file is usually pre-installed
# Install if missing
sudo pacman -S file

Summary

This guide covered file usage, file type detection, and MIME type identification for Arch Linux, CachyOS, and other distributions.


Next Steps


This guide covers Arch Linux, CachyOS, and other Linux distributions. For distribution-specific details, refer to your distribution's documentation.

Clone this wiki locally