from
Display messages from specific senders
TLDR
List mail
Display the number of messages stored
List mail in the specified mailbox directory
Print the mail from the specified address
SYNOPSIS
from [options] file...
PARAMETERS
-b
Brief mode: do not prepend filenames to the output.
-c
Check the compiled version of the magic file.
-f
Read the names of the files to be examined from
-F
Use
-i
If the file is an ordinary file, do not try to classify its contents.
-k
Don't stop at the first match, keep going.
-L
Follow symbolic links (if the operating system supports them).
-m
Specify an alternate magic file or list of files.
-n
Force standard output to be flushed after checking each file. Only useful if checking a list of files.
-N
Don't pad output to align file names.
-s
Read files even if they are special files.
-v
Print the version of the program and exit.
-z
Try to look inside compressed files.
DESCRIPTION
The from command in Linux attempts to determine the type of a file by examining its contents for characteristic byte sequences, known as magic numbers. Unlike file extensions, which can be misleading, from uses these magic numbers to provide a more accurate identification. It is especially useful when dealing with files without extensions or when unsure of a file's true format.
The command compares the initial bytes of a file against a database of known magic numbers defined in the magic file (usually /etc/magic). When a match is found, from reports the corresponding file type. While primarily used for identifying common file formats such as images, executables, and text files, it can also identify specific applications or data formats.
from is a valuable tool for system administrators, developers, and users who need to understand the nature of a file without relying solely on its name or extension. It is often used in scripting and automation tasks to process files based on their actual type.
CAVEATS
The accuracy of from depends on the completeness and accuracy of the magic file. It might not be able to identify all file types, especially less common or proprietary formats.
MAGIC FILE FORMAT
The magic file consists of a series of entries that specify the magic numbers and their corresponding file types. Each entry includes an offset, a type, a value, and a description. The from command reads this file sequentially, comparing the specified bytes in the input file against the values in the magic file.
EXIT STATUS
The from command exits with a status of 0 if it succeeds in identifying the file type, and a non-zero status if an error occurs.
HISTORY
The from command has been a part of Unix-like systems for a long time. Its development focuses on updating and expanding the magic file to recognize new and emerging file formats. Its initial purpose was to identify the type of binary files in Unix, predating reliance on file extensions.