Linux HOWTOs

About | Home | Search


HOWTO: findutils
Description: find, xargs, updatedb/locate
Click here for ChangeLog
NOTE: I use GNU tar >= 1.13.25 so it's -j for .tar.bz2 files,
it's safe to assume that make, gcc, binutils, fileutils/coreutils, gawk, sed, and grep are prerequisites for almost everything


# GNU findutils 4.4.2
# ===================
# Slackware 12.0, 12.1, 12.2: findutils 4.2.31
# Slackware 13.0, 13.1, 13.37: findutils 4.4.2

# Slackware uses the updatedb and locate from slocate.  As I write this,
# 'slocate' seems to no longer be in development, so that may change.  Some
# other distributions use mlocate instead.
# other distributions use mlocate instead.  FWIW, mlocate seems like it
# would be way faster by being more efficient.

# Prerequisites:
# gettext
# libiconv
# bison

# Get it
cd
test -f installed/findutils-4.4.2.tar.gz &&
 mv installed/findutils-4.4.2.tar.gz .
test ! -f findutils-4.4.2.tar.gz &&
 wget http://ftp.gnu.org/pub/gnu/findutils/findutils-4.4.2.tar.gz

# Verify tarball w/ md5sum:
# (this came from my gpg-verified tarball)
echo "351cc4adb07d54877fa15f75fb77d39f  findutils-4.4.2.tar.gz" | md5sum -c

# Verify tarball w/ sha1sum:
# (this also came from my gpg-verified tarball)
echo "e8dd88fa2cc58abffd0bfc1eddab9020231bb024  findutils-4.4.2.tar.gz" | \
 sha1sum -c

# Verify tarball w/ gpg:
( gpg --list-keys 13141C36 > /dev/null 2>&1 ||
 gpg --keyserver subkeys.pgp.net --recv-keys 13141C36 ) &&
  wget -nc http://ftp.gnu.org/pub/gnu/findutils/\
findutils-4.4.2.tar.gz.sig &&
   gpg --verify findutils-4.4.2.tar.gz.sig &&
    rm findutils-4.4.2.tar.gz.sig

# Extract the tarball
mkdir -p -m 0700 src
cd src
find -maxdepth 1 -type d -name "findutils-*" -exec rm -r {} \;
tar xzvf ~/findutils-4.4.2.tar.gz
cd findutils-4.4.2
test $UID = 0 && chown -R root:root .

# I use --disable-nls because I only read/write English (well), if this
# is not the case for you, leave that off

# locate and updatedb both now include slocate compatibility

# Configure and build it
./configure --prefix=/usr --infodir=/usr/info --mandir=/usr/man \
--disable-nls
make

# Become root to install it
su

# Remove the Slackware package, if there is one
test -x /sbin/removepkg && /sbin/removepkg find findutils

# Remove old files that may be left over from previous versions
./find/find /usr/share/locale -type f -name findutils.mo -exec rm {} \;

# Remove the old locate db dir location
test -d /var/spool/locate && rm -r /var/spool/locate

# If you also have 'slocate' installed, remove the locate and updatedb
# symlinks from it (you can still run 'slocate'):
test -L /usr/bin/locate && rm /usr/bin/locate
test -L /usr/bin/updatedb && rm /usr/bin/updatedb

# Install findutils, stripping the binaries
make install-strip

# The current locate puts its database here:
# /usr/var/locatedb
#
# If you also have slocate installed, you can use this locate with it's
# database by running something like this:
# locate -d /var/lib/slocate/slocate.db
#
# If you want this updatedb to create a slocate-format database, run it
# like so:
# updatedb --dbformat=slocate
#
# Generally 'slocate' runs via a cron with a /etc/cron.daily/slocate like
# this:
# #!/bin/sh
# /usr/bin/updatedb -c /etc/updatedb.conf
# (which is the same as '/usr/bin/slocate -u -c /etc/updatedb.conf')
#
# To use this findutils updatedb via cron, try a /etc/cron.daily/locate like
# this:
# #!/bin/sh
# ionice -c3 nice -n 19 /usr/bin/updatedb
# (and if you have slocate installed, remove/disable that one from running)
#
# See 'man updatedb' and 'man locate' for information about using
# environment variables too.

# Make sure your non-root user can remove the source later
chown -R $(logname) .
chmod -R u+w .

# Become yourself again
exit

# Keep the tarball for later
cd
mkdir -p -m 0700 installed
rm -f installed/findutils-*.tar.*
mv findutils-4.4.2.tar.gz installed/


# If you ever want to uninstall findutils, this should do it:
cd
su
test -d src/findutils-* && ( cd src/findutils-* ; make uninstall )
( cd /usr/bin ; rm -f find locate oldfind updatedb xargs )
( cd /usr/info ; rm -f find.info find-maint.info )
( cd /usr/libexec ; rm -f bigram code frcode )
( cd /usr/man/man1 ; rm -f find.1 locate.1 updatedb.1 xargs.1 )
rm -f /usr/man/man5/locatedb.5
exit
find ~/src -maxdepth 1 -type d -name "findutils-*" -exec rm -r {} \;
rm -f ~/installed/findutils-*.tar.*

Back to the list


Last updated: Wed, 29 Apr 2020 22:04:50 -0400
Jason Englander <jason at englanders dot us>