Jump to content

File (command)

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Phil websurfer@yahoo.com (talk | contribs) at 07:15, 14 January 2005 (created page). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)

file is a program originated in Unix that runs under the shell (command-line) to determine the file type heuristically instead of other simpler ways to classify it, like with file extensions, MIMEs, etc. It also extracts the magic number from executable files.

History

The original version originated from the Unix Research Version 4 as far as 1973. Then in System V was a major update with important changes (making it more flexible but slower) written by Ian Darwin from scratch. Geoff Collyer added more features and more accuracy in 1989. Other people has added functionality, like Guy Harris, Chris Lowth, Eric Fischer, and many others. The SunOS 3.2 and the current version are similar and compatible with the SVR4 because it is an improved version of the Sun program. It is currently mantained by Christos Zoulas. It is licensed under BSDAdClause and some parts are in the public domain.


Linux Output Examples

      file.c:   C program text
      file:     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)
      /dev/wd0b: data
      /dev/wd0d: x86 boot sector
      /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
      file.c:     text/x-c
      file:       application/x-executable, dynamically linked (uses shared libs),not stripped
      /dev/hda:    application/x-not-regular-file
      /dev/wd0a:   application/x-not-regular-file

Official Webpage