Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Contact Us
Online Help
Domain Status
Man Pages

Virtual Servers

Topology Map

Server Agreement
Year 2038

USA Flag



Man Pages

Manual Reference Pages  -  XPLORETYPE (1)


xploretype - xplore file type tester


See Also


xploretype [-m magic_file] [-f] filename ...


The xploretype program reads a magic configuration file and tests each file in its command line to tell its type according to the magic file.

The format of the magic file is the same as that of the standard UNIX magic(4) file with the following additions and differences:
mode type field.
  Similar to long type, but offset is ignored. The test is performed against the st_mode field of the stat structure obtained using stat(2) system call. This allows testing for directories, fifos ... as well as for file permissions.
lmode type field.
  Similar to mode type, but using lstat(2) instead of stat(2). This allows testing for symbolic links.
builtin type field.
  The test succeeds if the built-in type of the file is the same as the value field. The built-in type of the file is the type returned when all the tests fail. Currently these are the built-in types:

"unreadable" The file could not be read.

"emptydir" File is an empty directory.

"directory" File is a nonempty directory.

"special" Not a regular file.

"empty" File size is zero.

"ascii" The file looks like ascii.

"data" None of the above.

regexp type field.
  The value field must be a proper regular expression. The bytes starting at offset are matched against it. If the match succeeds, then a regsub(3) is performed on message yielding the final message. If the type field is of the form regexp&nnn where nnn is a positive number, then that number controls the amount of data scanned for the matching, otherwise a compile defined value (currently 256) is used.
long and short byte order.
  xploretype always reads longs and shorts using MSB-first order. This makes configuration files portable to all architectures, but some entries in original magic(4) files might be wrong.
Continuation lines.
  If a line ends with a backslash character (\), it is continued with the following line. The maximum length of a line is 1024 characters (counting also characters in continuation lines).


-f file
  Consider the following argument as a file, even if it begins with ‘-’.
-m file
  Specifies the magic file to be used for testing file types. By default, xploretype uses the system-wide magic file in the xplore library directory. The -m option can be used to test against alternative magic files. Multiple magic files may be specified; they are considered in the order in which they are found on the command line. Each file on the command line is tested against the magic file of the most recent -m option. Files specified before the first -m option are tested against the default magic file.


Bad configuration lines cause undefined behavior. In general they are silently ignored, but that is not guaranteed.

There are no warning or error messages except for the regular expression syntax.

There should be a syntax checking mode.

All of the above apply to xplore too.


xplore(1x), file(1), magic(4), stat(2), lstat(2),


Copyright (c) 1995 CNM-US
Copyright (c) 1995 Juan D. Martin


Juan D. Martin (; slightly modified for use with xplore by Albert Graef (
Search for    or go to Top of page |  Section 1 |  Main Index

X Version 11 XPLORETYPE (1) Apr 20 1997

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.