📄 file.man
字号:
.It Fl v , -versionPrint the version of the program and exit..It Fl z , -uncompressTry to look inside compressed files..It Fl 0 , -print0Output a null character.Sq \e0after the end of the filename. Nice to.Xr cut 1the output. This does not affect the separator which is still printed..It Fl -helpPrint a help message and exit..El.Sh FILES.Bl -tag -width __MAGIC__.mime.mgc -compact.It Pa __MAGIC__.mgcDefault compiled list of magic numbers.It Pa __MAGIC__Default list of magic numbers.It Pa __MAGIC__.mime.mgcDefault compiled list of magic numbers, used to output mime types whenthe .Fl ioption is specified..It Pa __MAGIC__.mimeDefault list of magic numbers, used to output mime types when the .Fl ioption is specified..El.Sh ENVIRONMENTThe environment variable.Dv MAGICcan be used to set the default magic number file name.If that variable is set, then.Nmwill not attempt to open.Pa $HOME/.magic ..Nmadds.Dq .mimeand/or.Dq .mgcto the value of this variable as appropriate.The environment variable.Dv POSIXLY_CORRECTcontrols (on systems that support symbolic links), if.Nmwill attempt to follow symlinks or not. If set, then.Nmfollows symlink, otherwise it does not. This is also controlledby the.Fl Land.Fl hoptions..Sh SEE ALSO.Xr magic __FSECTION__ ,.Xr strings 1 ,.Xr od 1 ,.Xr hexdump 1.Sh STANDARDS CONFORMANCEThis program is believed to exceed the System V Interface Definitionof FILE(CMD), as near as one can determine from the vague languagecontained therein. Its behavior is mostly compatible with the System V program of the same name.This version knows more magic, however, so it will producedifferent (albeit more accurate) output in many cases. .\" URL: http://www.opengroup.org/onlinepubs/009695399/utilities/file.html.PpThe one significant difference between this version and System Vis that this version treats any white spaceas a delimiter, so that spaces in pattern strings must be escaped.For example,.Bd -literal -offset indent >10 string language impress\ (imPRESS data).Ed.Ppin an existing magic file would have to be changed to.Bd -literal -offset indent >10 string language\e impress (imPRESS data).Ed.PpIn addition, in this version, if a pattern string contains a backslash,it must be escaped.For example.Bd -literal -offset indent 0 string \ebegindata Andrew Toolkit document.Ed.Ppin an existing magic file would have to be changed to.Bd -literal -offset indent 0 string \e\ebegindata Andrew Toolkit document.Ed.PpSunOS releases 3.2 and later from Sun Microsystems include a.Nm command derived from the System V one, but with some extensions.My version differs from Sun's only in minor ways.It includes the extension of the .Sq &operator, used as,for example,.Bd -literal -offset indent >16 long&0x7fffffff >0 not stripped.Ed.Sh MAGIC DIRECTORYThe magic file entries have been collected from various sources,mainly USENET, and contributed by various authors.Christos Zoulas (address below) will collect additionalor corrected magic file entries.A consolidation of magic file entries will be distributed periodically..PpThe order of entries in the magic file is significant.Depending on what system you are using, the order thatthey are put together may be incorrect.If your old.Nmcommand uses a magic file,keep the old magic file around for comparison purposes(rename it to .Pa __MAGIC__.orig )..Sh EXAMPLES.Bd -literal -offset indent $ file file.c file /dev/{wd0a,hda}file.c: C program textfile: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), stripped/dev/wd0a: block special (0/0)/dev/hda: block special (3/0)$ file -s /dev/wd0{b,d}/dev/wd0b: data/dev/wd0d: x86 boot sector$ file -s /dev/hda{,1,2,3,4,5,6,7,8,9,10}/dev/hda: x86 boot sector/dev/hda1: Linux/i386 ext2 filesystem/dev/hda2: x86 boot sector/dev/hda3: x86 boot sector, extended partition table/dev/hda4: Linux/i386 ext2 filesystem/dev/hda5: Linux/i386 swap file/dev/hda6: Linux/i386 swap file/dev/hda7: Linux/i386 swap file/dev/hda8: Linux/i386 swap file/dev/hda9: empty/dev/hda10: empty$ file -i file.c file /dev/{wd0a,hda}file.c: text/x-cfile: application/x-executable, dynamically linked (uses shared libs), not stripped/dev/hda: application/x-not-regular-file/dev/wd0a: application/x-not-regular-file.Ed.Sh HISTORYThere has been a .Nm command in every .Dv UNIX since at least Research Version 4(man page dated November, 1973).The System V version introduced one significant major change:the external list of magic number types.This slowed the program down slightly but made it a lot more flexible..PpThis program, based on the System V version,was written by Ian Darwin <ian@darwinsys.com>without looking at anybody else's source code..PpJohn Gilmore revised the code extensively, making it better thanthe first version.Geoff Collyer found several inadequaciesand provided some magic file entries.Contributions by the `&' operator by Rob McMahon, cudcv@warwick.ac.uk, 1989..PpGuy Harris, guy@netapp.com, made many changes from 1993 to the present..PpPrimary development and maintenance from 1990 to the present byChristos Zoulas (christos@astron.com)..PpAltered by Chris Lowth, chris@lowth.com, 2000:Handle the .Fl ioption to output mime type strings and using an alternativemagic file and internal logic..PpAltered by Eric Fischer (enf@pobox.com), July, 2000,to identify character codes and attempt to identify the languagesof non-ASCII files..PpThe list of contributors to the "Magdir" directory (source for the.Pa __MAGIC__file) is too long to include here.You know who you are; thank you..Sh LEGAL NOTICECopyright (c) Ian F. Darwin, Toronto, Canada, 1986-1999.Covered by the standard Berkeley Software Distribution copyright; see the fileLEGAL.NOTICE in the source distribution..PpThe files.Dv tar.hand.Dv is_tar.cwere written by John Gilmore from his public-domain.Xr tar 1program, and are not covered by the above license..Sh BUGSThere must be a better way to automate the construction of the Magicfile from all the glop in Magdir.What is it?.\" Compilation support has been done.\" Better yet, the magic file should be compiled into binary (say,.\" .Xr ndbm 3.\" or, better yet, fixed-length.\" .Dv ASCII.\" strings for use in heterogenous network environments) for faster startup..\" Then the program would run as fast as the Version 7 program of the same.\" name, with the flexibility of the System V version..Pp.Nmuses several algorithms that favor speed over accuracy,thus it can be misled about the contents oftextfiles..PpThe support for text files (primarily for programming languages)is simplistic, inefficient and requires recompilation to update..\" Else support has been done.\" There should be an.\" .Dv else.\" clause to follow a series of continuation lines..\" .Pp.\" Regular expression support has been done.\" The magic file and keywords should have regular expression support.Their use of.Dv ASCII TABas a field delimiter is ugly and makesit hard to edit the files, but is entrenched..PpIt might be advisable to allow upper-case letters in keywordsfor e.g.,.Xr troff 1commands vs man page macros.Regular expression support would make this easy..PpThe program doesn't grok .Dv FORTRAN .It should be able to figure.Dv FORTRANby seeing some keywords which appear indented at the start of line.Regular expression support would make this easy..PpThe list of keywords in .Dv ascmagicprobably belongs in the Magic file.This could be done by using some keyword like .Sq *for the offset value..Pp.\" Sorting has been done..\" Another optimization would be to sort.\" the magic file so that we can just run down all the.\" tests for the first byte, first word, first long, etc, once we.\" have fetched it.Complain about conflicts in the magic file entries.Make a rule that the magic entries sort based on file offset ratherthan position within the magic file?.PpThe program should provide a way to give an estimate of .Dq how gooda guess is.We end up removing guesses (e.g. .Dq From\ as first 5 chars of file) becausethey are not as good as other guesses (e.g. .Dq Newsgroups:versus.Dq Return-Path:).Still, if the others don't pan out, it should be possible to use thefirst guess. .PpThis program is slower than some vendors' file commands.The new support for multiple character codes makes it even slower..PpThis manual page, and particularly this section, is too long..Sh AVAILABILITYYou can obtain the original author's latest version by anonymous FTPon.Dv ftp.astron.comin the directory.Dv /pub/file/file-X.YZ.tar.gz
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -