Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ file(1) — SunOS 5.4

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

filehdr(4)

magic(4)

environ(5)

file(1)

NAME

file − determine file type

SYNOPSIS

file [ −h ] [ −m mfilename ] [ −f ffilename ] argument ...
file [ −h ] [ −m mfilename ] −f ffilename
file −c [ −m mfilename ]

AVAILABILITY

SUNWcsu

DESCRIPTION

file performs a series of tests on each file supplied by argument and, optionally, on each file supplied in ffilename in an attempt to classify it.  If argument appears to be a text file, file examines the first 512 bytes and tries to guess its programming language.  If argument is an executable a.out, file prints the version stamp, provided it is greater than 0.  If argument is a symbolic link, by default the link is followed and file tests the file that the symbolic link references. 

file uses /etc/magic to identify files that have a magic number.  A magic number is a numeric or string constant that indicates the file type.  Commentary at the beginning of /etc/magic explains its format. 

OPTIONS

−c Check the magic file for format errors.  For reasons of efficiency, this validation is normally not carried out. 

−h Do not follow symbolic links. 

−f ffilename ffilename contains the names of the files to be examined. 

−m mfilename Use mfilename as an alternate magic file, instead of /etc/magic . 

ENVIRONMENT

If any of the LC_∗ variables ( LC_CTYPE, LC_MESSAGES, LC_TIME, LC_COLLATE, LC_NUMERIC, and LC_MONETARY ) (see environ(5)) are not set in the environment, the operational behavior of file for each corresponding locale category is determined by the value of the LANG environment variable.  If LC_ALL is set, its contents are used to override both the LANG and the other LC_∗ variables.  If none of the above variables is set in the environment, the "C"  (U.S. style) locale determines how file behaves. 

LC_CTYPE
Determines how file handles characters. When LC_CTYPE is set to a valid value, file can display and handle text and filenames containing valid characters for that locale.  file can display and handle Extended Unix Code (EUC) characters where any individual character can be 1, 2, or 3 bytes wide.  file can also handle EUC characters of 1, 2, or more column widths. In the "C" locale, only characters from ISO 8859-1 are valid. 

LC_MESSAGES
Determines how diagnostic and informative messages are presented. This includes the language and style of the messages, and the correct form of affirmative and negative responses.  In the "C" locale, the messages are presented in the default form found in the program itself (in most cases, U.S. English).

FILES

/etc/magic

SEE ALSO

filehdr(4), magic(4), environ(5),

DIAGNOSTICS

If the −h option is specified and argument is a symbolic link, file prints the error message:

symbolic link to argument

SunOS 5.4  —  Last change: 14 Sep 1992

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026