FILE(1) — NEWS-OS Programmer’s Manual
名称
file − ファイルのタイプを判定する
形式
file [ −c ] [ −f ffile ] [ −m mfile ] filename ...
解説
file は、 引数で指定されたファイルに対して一連のテストを 行い、 その分類を 試みます。 ファイルが ASCII 形式であると、 file は、 最初の 1024 バイトを 調べ、 その言語は何かを 突き止めようとします。 また、ファイルが a.out の実行可能ファイルである場合 CPU タイプ (68k、mips) を表示します。 file はファイルがシンボリックリンクである場合 リンク先のファイル名とファイルのタイプを 次のように表示します。
symbolic link to filename of type
file は /etc/magic を参照して magic number により、ファイルを判別します。 magic number はファイルのタイプを表すために、 ファイルの中 (通常は先頭) に置かれた数字や文字です。
オプション
−c マジックナンバファイル のフォマットをチェックします。 通常は使われません。 −c をつけるとファイルのタイプ判別は行いません。
−f ffile ffile に書かれたファイルを判別します。
−m mfile mfile をマジックナンバファイルとして使用します。
多国語対応
ファイルに JIS、 Shift-JIS、 EUC、 TCA、メールコードが ある場合、それを判別します。 JIS コードおよびメールコードは、 以下のエスケープシーケンスをもとに判別します。
ESC $ @JIS C 6226-1978 漢字
ESC $ BJIS X 0208-1983 漢字
ESC ( BASCII (ANSI X3.4-1986)
ESC ( JJIS X 0201-1976 ローマ文字
ESC ( IJIS X 0201-1976 片仮名
ESC ( Hスウェーデン名前用 (JIS ローマ文字として使われる場合あり)
ESC $ ( C韓国語 (KS C 5601-1987)
ESC $ ( 0, ESC $ ( 1, ESC $ ( ?中国語(台湾 CNS 11643-1986)
判定ファイルタイプ
• ファイルステータスモードに関する情報
symbolic link to [file name]
character special (Major/Minor)
block special (Major/Minor)
directory
fifo
socket
• ファイルの内容に関する情報 (マジックナンバファイルに依存しない)
empty
executable script for /bin/csh
executable script for /bin/sh
c-shell commands
shell commands
sccs
RCS file
PRESS file
data
c program text
fortran program text
assembler program text
[nt]roff, tbl, or eqn input text
troff (CAT) output
commands text
troff intermediate output text
english text
ascii text
• ファイルの内容に関する情報 (マジックナンバファイルに依存)
cpio archive
ASCII cpio archive
very old archive
apl workspace
packed data
System V Rel.1 ar archive
current ar archive
pdp11/pre System V vax executable
unix-rt ldp
pdp11 overlay
pdp11/pre System V vax pure executable
demand-page executable
pdp11 separate I&D
pdp11 kernel overlay
vax executable
vax pure executable
basic-16 executable
basic-16 executable (TV)
x86 executable
x86 executable (TV)
3b20 executable
3b20 executable (TV)
3b2/3b5 executable
3b2/3b5 executable (TV)
MC68k executable
MC68k executable (shared)
MC68k executable (shared demand paged)
68k executable
68k pure executable
68k demand paged pure executable
PostScript document
Frame Maker document
Frame Maker MIF file
Frame Maker MML file
MIPS endian big executable
MIPS endian big pure
MIPS endian big demand paged
MIPS endian little executable
MIPS endian little pure
MIPS endian little demand paged
swapped MIPS-eb executable
swapped MIPS-eb pure
swapped MIPS-eb demand paged
swapped MIPS-el executable
swapped MIPS-el pure
swapped MIPS-el demand paged
MIPS endian big ucode
MIPS endian little ucode
MS-DOS library
Microsoft x.out
old Microsoft 8086 x.out
BSD archive random library
MIPS archive
archive
compressed data
SONY multi media format
CDFF file
関連ファイル
/etc/magicマジックナンバファイル
関連事項
バグ
しばしば誤りを犯します。 特に、 コマンドファイルを C プログラムと判定することがよくあります。
Pascal または LISP は認識しません。
NEWS-OSRelease 4.2.1R