Linux file Guide - ryzendew/Linux-Tips-and-Tricks GitHub Wiki
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
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
- stat Guide - File statistics
- ls Guide - List files
- File Operations - File management
- file Documentation:
man file
This guide covers Arch Linux, CachyOS, and other Linux distributions. For distribution-specific details, refer to your distribution's documentation.