6.58. Findutils-4.6.0

The Findutils package contains programs to find files. These programs are provided to recursively search through a directory tree and to create, maintain, and search a database (often faster than the recursive find, but unreliable if the database has not been recently updated).

Approximate build time: 0.7 SBU
Required disk space: 51 MB

6.58.1. Installation of Findutils

First, suppress a test which on some machines can loop forever:

sed -i 's/test-lock..EXEEXT.//' tests/Makefile.in

Next, make some fixes required by glibc-2.28 and later:

sed -i 's/IO_ftrylockfile/IO_EOF_SEEN/' gl/lib/*.c
sed -i '/unistd/a #include <sys/sysmacros.h>' gl/lib/mountlist.c
echo "#define _IO_IN_BACKUP 0x100" >> gl/lib/stdio-impl.h

Prepare Findutils for compilation:

./configure --prefix=/usr --localstatedir=/var/lib/locate

The meaning of the configure options:

--localstatedir

This option changes the location of the locate database to be in /var/lib/locate, which is FHS-compliant.

Compile the package:

make

To test the results, issue:

make check

Install the package:

make install

Some packages in BLFS and beyond expect the find program in /bin, so make sure it's placed there:

mv -v /usr/bin/find /bin
sed -i 's|find:=${BINDIR}|find:=/bin|' /usr/bin/updatedb

6.58.2. Contents of Findutils

Installed programs: code, find, locate, oldfind, updatedb, and xargs

Short Descriptions

code

Was formerly used to produce locate databases; it is the ancestor of frcode

find

Searches given directory trees for files matching the specified criteria

locate

Searches through a database of file names and reports the names that contain a given string or match a given pattern

oldfind

Older version of find, using a different algorithm

updatedb

Updates the locate database; it scans the entire file system (including other file systems that are currently mounted, unless told not to) and puts every file name it finds into the database

xargs

Can be used to apply a given command to a list of files