6.24. Installing File-3.36

Estimated build time:           1 minute
Estimated required disk space:  2 MB

6.24.1. Installation of File

Install File by running the following commands:

cp readelf.h readelf.h.backup &&
sed $'/#define __/a \\\n#include <stdint.h>' readelf.h.backup > readelf.h &&
./configure --prefix=/usr --datadir=/usr/share/misc &&
make &&
make install

File uses magic numbers to determine a file type. These magic numbers come with File in a plain text file. File internally compiles this database each time it is run. This is not the normal type of operation for File since compiling a plain text file each time is not the fastest way to do it. File offers an option "-C" to compile this magic number file. The reason this isn't done automatically is that some people like to work on the magic numbers. On the other hand many people didn't get it that they should compile the magic numbers, so the author of File added a warning when the plain text magic file is used. As we usually won't work on the plain text magic file, we compile this file, because it's faster, fixes that annoying warning and is how it was meant to be:

file -C

6.24.2. Command explanations

sed $'/#define __/a \\\n#include <stdint.h>' readelf.h.backup > readelf.h : This sed fixes an error which occurs when compiling file-3.36 with automake-1.5 installed.

6.24.3. Contents

The File package contains the file program.

6.24.4. Description

File tests each specified file in an attempt to classify it. There are three sets of tests, performed in this order: filesystem tests, magic number tests, and language tests. The first test that succeeds causes the file type to be printed.

6.24.5. Dependencies

File-3.36 needs the following to be installed:


sh from the bash package

as from the binutils package
ld from the binutils package

cmp from the diffutils package

chmod from the fileutils package
cp from the fileutils package
ls from the fileutils package
mv from the fileutils package
rm from the fileutils package

cc from the gcc package

egrep from the grep package
grep from the grep package

make from the make package

sed from the sed package

basename from the sh-utils package
expr from the sh-utils package
sleep from the sh-utils package

cat from the textutils package
tr from the textutils package