aboutsummaryrefslogtreecommitdiffstats
path: root/chapter06/findutils.xml
blob: 94a2985b0b51012902994f0eac9e6ba9641a0e76 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
  "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
  <!ENTITY % general-entities SYSTEM "../general.ent">
  %general-entities;
]>

<sect1 id="ch-system-findutils" role="wrap">
  <?dbhtml filename="findutils.html"?>

  <sect1info condition="script">
    <productname>findutils</productname>
    <productnumber>&findutils-version;</productnumber>
    <address>&findutils-url;</address>
  </sect1info>

  <title>Findutils-&findutils-version;</title>

  <indexterm zone="ch-system-findutils">
    <primary sortas="a-Findutils">Findutils</primary>
  </indexterm>

  <sect2 role="package">
    <title/>

    <para>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).</para>

    <segmentedlist>
      <segtitle>&buildtime;</segtitle>
      <segtitle>&diskspace;</segtitle>

      <seglistitem>
        <seg>&findutils-ch6-sbu;</seg>
        <seg>&findutils-ch6-du;</seg>
      </seglistitem>
    </segmentedlist>

  </sect2>

  <sect2 role="installation">
    <title>Installation of Findutils</title>

    <para>Prepare Findutils for compilation:</para>

<screen><userinput remap="configure">./configure --prefix=/usr --localstatedir=/var/lib/locate</userinput></screen>

    <variablelist>
      <title>The meaning of the configure options:</title>

      <varlistentry>
        <term><parameter>--localstatedir</parameter></term>
        <listitem>
          <para>This option changes the location of the <command>locate</command>
          database to be in <filename class="directory">/var/lib/locate</filename>,
          which is FHS-compliant.</para>
        </listitem>
      </varlistentry>

    </variablelist>

    <para>Compile the package:</para>

<screen><userinput remap="make">make</userinput></screen>

    <para>To test the results, issue:</para>

<screen><userinput remap="test">make check</userinput></screen>

    <para>Install the package:</para>

<screen><userinput remap="install">make install</userinput></screen>

    <para>Some of the scripts in the LFS-Bootscripts package depend on
    <command>find</command>.  As <filename class="directory">/usr</filename>
    may not be available during the early stages of booting, this program
    needs to be on the root partition.  The <command>updatedb</command>
    script also needs to be modified to correct an explicit path:</para>

<screen><userinput remap="install">mv -v /usr/bin/find /bin
sed -i 's/find:=${BINDIR}/find:=\/bin/' /usr/bin/updatedb</userinput></screen>

  </sect2>

  <sect2 id="contents-findutils" role="content">
    <title>Contents of Findutils</title>

    <segmentedlist>
      <segtitle>Installed programs</segtitle>
      <segtitle>Installed directory</segtitle>

      <seglistitem>
        <seg>bigram, code, find, frcode, locate, oldfind, updatedb, and xargs</seg>
        <seg>/usr/lib/findutils</seg>
      </seglistitem>
    </segmentedlist>

    <variablelist>
      <bridgehead renderas="sect3">Short Descriptions</bridgehead>
      <?dbfo list-presentation="list"?>
      <?dbhtml list-presentation="table"?>

      <varlistentry id="bigram">
        <term><command>bigram</command></term>
        <listitem>
          <para>Was formerly used to produce <command>locate</command>
          databases</para>
          <indexterm zone="ch-system-findutils bigram">
            <primary sortas="b-bigram">bigram</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="code">
        <term><command>code</command></term>
        <listitem>
          <para>Was formerly used to produce <command>locate</command>
          databases; it is the ancestor of <command>frcode</command>.</para>
          <indexterm zone="ch-system-findutils code">
            <primary sortas="b-code">code</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="find">
        <term><command>find</command></term>
        <listitem>
          <para>Searches given directory trees for files matching the specified
          criteria</para>
          <indexterm zone="ch-system-findutils find">
            <primary sortas="b-find">find</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="frcode">
        <term><command>frcode</command></term>
        <listitem>
          <para>Is called by <command>updatedb</command> to compress the list
          of file names; it uses front-compression, reducing the database size
          by a factor of four to five.</para>
          <indexterm zone="ch-system-findutils frcode">
            <primary sortas="b-frcode">frcode</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="locate">
        <term><command>locate</command></term>
        <listitem>
          <para>Searches through a database of file names and reports the names
          that contain a given string or match a given pattern</para>
          <indexterm zone="ch-system-findutils locate">
            <primary sortas="b-locate">locate</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="oldfind">
        <term><command>oldfind</command></term>
        <listitem>
          <para>Older version of find, using a different algorithm</para>
          <indexterm zone="ch-system-findutils oldfind">
            <primary sortas="b-oldfind">oldfind</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="updatedb">
      <term><command>updatedb</command></term>
        <listitem>
          <para>Updates the <command>locate</command> 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</para>
          <indexterm zone="ch-system-findutils updatedb">
            <primary sortas="b-updatedb">updatedb</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="xargs">
        <term><command>xargs</command></term>
        <listitem>
          <para>Can be used to apply a given command to a list of files</para>
          <indexterm zone="ch-system-findutils xargs">
            <primary sortas="b-xargs">xargs</primary>
          </indexterm>
        </listitem>
      </varlistentry>

    </variablelist>

  </sect2>

</sect1>