<?xml version="1.0" encoding="ISO-8859-1"?><html xmlns="http://www.w3.org/1999/xhtml" xmlns:xh="http://www.w3.org/1999/xhtml" xmlns:axle="http://www.cs.odu.edu/~zeil/axle" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:ns0="http://www.cs.odu.edu/~zeil/axle" mode="ignore" ns0:xlinkuri="open/unix.dbk" ns0:xpath="/html" ns0:page="unix" foo="0 " ns0:last="/cocoon/~cs252/open/unix/section-8.2.html"><head><title>An Introduction to Unix</title><link type="text/css" href="_axle/docbookstyle.css" rel="stylesheet"/><link type="text/css" href="_axle/cppformat.css" rel="stylesheet"/><link type="text/css" href="_axle/overrides.css" rel="stylesheet"/><script src="_axle/docbook.js"/><link href="http://cocoon.cs.odu.edu:80/cocoon/~cs252/open/unix/section-2.4.html" title="Next" rel="next"/><link href="http://cocoon.cs.odu.edu:80/cocoon/~cs252/open/unix/section-2.2.html" title="Prev" rel="prev"/><link href="http://cocoon.cs.odu.edu:80/cocoon/~cs252/open/unix/section-2.html" title="Up" rel="up"/><link href="http://cocoon.cs.odu.edu:80/cocoon/~cs252/open/unix/unix.html" title="First" rel="first"/><link href="http://cocoon.cs.odu.edu:80/cocoon/~cs252/open/unix/section-8.2.html" title="Last" rel="last"/><script>function gotoNext() {top.location.href="/cocoon/~cs252/open/unix/section-2.4.html";}
function gotoPrev() {top.location.href="/cocoon/~cs252/open/unix/section-2.2.html";}
function gotoUp() {top.location.href="/cocoon/~cs252/open/unix/section-2.html";}
</script><xhtml:link xmlns:xhtml="http://www.w3.org/1999/xhtml" rel="stylesheet" href="_axle/navigation.css" type="text/css"/><xhtml:script xmlns:xhtml="http://www.w3.org/1999/xhtml" src="_axle/navigation.js"/></head><body><table width="100%" class="navigationBar"><tr class="navigationBar"><td width="5%" class="navigationBar"><a class="navigationBarArrow" title="First" href="http://cocoon.cs.odu.edu:80/cocoon/~cs252/open/unix/unix.html"><img class="navigationBar" src="_axle/first.gif" alt="First"/></a></td><td width="5%" class="navigationBar"><a class="navigationBarArrow" title="Prev" href="http://cocoon.cs.odu.edu:80/cocoon/~cs252/open/unix/section-2.2.html"><img class="navigationBar" src="_axle/prev.gif" alt="Prev"/></a></td><td width="5%" class="navigationBar"><a class="navigationBarArrow" title="Up" href="http://cocoon.cs.odu.edu:80/cocoon/~cs252/open/unix/section-2.html"><img class="navigationBar" src="_axle/up.gif" alt="Up"/></a></td><td width="5%" class="navigationBar"><a class="navigationBarArrow" title="Next" href="http://cocoon.cs.odu.edu:80/cocoon/~cs252/open/unix/section-2.4.html"><img class="navigationBar" src="_axle/next.gif" alt="Next"/></a></td><td width="5%" class="navigationBar"><a class="navigationBarArrow" title="Last" href="http://cocoon.cs.odu.edu:80/cocoon/~cs252/open/unix/section-8.2.html"><img class="navigationBar" src="_axle/last.gif" alt="Last"/></a></td><td class="navigationBar"/><td width="5%" class="navigationBar"><a class="navigationBar" title="CS252 Home" href="http://cocoon.cs.odu.edu:80/cocoon/~cs252/directory/announcements.html"><img class="navigationBar" src="_axle/home.gif" alt="CS252 Home"/></a></td><td width="5%" class="navigationBar"><a class="navigationBar" title="discuss this page" href="http://cocoon.cs.odu.edu:80/cocoon/~cs252/forum/getXPath/open/unix/section-2.3.html"><img class="navigationBar" src="_axle/forum.gif" alt="discuss this page"/></a></td></tr></table><br/><script type="text/javascript">
checkForAnchorOnOtherPage('section-1','unix');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('mainmini','mainmini');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('section-1.1.1','mainmini');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('displays','mainmini');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('networks','mainmini');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('taleof2','taleof2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('section-1.2.1','taleof2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('pcrev','taleof2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref1','taleof2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref1_live','taleof2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref2','taleof2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref2_live','taleof2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fnote1','taleof2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fnote2','taleof2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('mswin','taleof2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('reflections','reflections');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref3','reflections');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref3_live','reflections');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fnote3','reflections');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('ssh','ssh');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref4','ssh');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref4_live','ssh');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('puttyConnect','ssh');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('sshConnect','ssh');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fnote4','ssh');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('login','login');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('termtypes','termtypes');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref5','termtypes');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref5_live','termtypes');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fnote5','termtypes');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('section-1.7','section-1.7');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('section-1.8','section-1.8');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('section-2','section-2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('section-2.1','section-2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref6','section-2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref6_live','section-2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref7','section-2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref7_live','section-2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('basicFileCmds','section-2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref8','section-2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref8_live','section-2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fnote8','section-2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('cmdlist','section-2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('session','section-2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('rlogin','section-2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('filemanip','section-2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('cdcmd','section-2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('findcmd','section-2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('lsa','section-2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('lsF','section-2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('pwdcmd','section-2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('textmanip','section-2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('catcmd','section-2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('morecmd','section-2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('printing','section-2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fnote6','section-2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fnote7','section-2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('section-2.2','section-2.2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref9','section-2.2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref9_live','section-2.2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('paths','section-2.2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref10','section-2.2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref10_live','section-2.2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fnote10','section-2.2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('specialChar','section-2.2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('cmdpatterns','section-2.2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref11','section-2.2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref11_live','section-2.2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('wildcards','section-2.2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref12','section-2.2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref12_live','section-2.2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fnote12','section-2.2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('regexp','section-2.2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('grepregexps','section-2.2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref13','section-2.2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref13_live','section-2.2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref14','section-2.2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref14_live','section-2.2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fnote13','section-2.2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fnote14','section-2.2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('sedregexps','section-2.2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref15','section-2.2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref15_live','section-2.2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref16','section-2.2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref16_live','section-2.2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fnote15','section-2.2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fnote16','section-2.2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fnote11','section-2.2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('quoting','section-2.2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref17','section-2.2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref17_live','section-2.2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fnote17','section-2.2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fnote9','section-2.2');
</script><div class="sect2" id="section-2.3" ns0:xpath="//*[@id='section-2.3']" ns0:page="section-2.3" ns0:next="/cocoon/~cs252/open/unix/section-2.4.html" ns0:prev="/cocoon/~cs252/open/unix/section-2.2.html" ns0:up="/cocoon/~cs252/open/unix/section-2.html" foo="0 " ns0:last="/cocoon/~cs252/open/unix/section-8.2.html" ns0:first="/cocoon/~cs252/open/unix/unix.html"><div class="info_sect2"><div class="title_sect3">2.3. Modifying and Combining Commands</div></div><div class="TOC">Contents:<div class="TOC-section2"><a href="#redirect">2.3.1 Redirection</a></div><div class="TOC-section2"><a href="#piping">2.3.2 Pipes</a></div><div class="TOC-section2"><a href="#xargs">2.3.3 xargs</a></div><div class="TOC-section2"><a href="#find">2.3.4 find</a></div></div><p class="para">One of the interesting ideas that pervades Unix is that many, if not
most, programs can be viewed as <span class="quote">
      &#8220;filters&#8221;
    </span> or <span class="quote">
      &#8220;transforms&#8221;
    </span> that
take a stream of text as input and produce an altered stream of text
as output. Many Unix commands are designed to perform relatively
trivial tasks, perhaps not very useful by themselves, that can be
chained together in interesting and useful ways.</p><p class="para">The practical consequence of this is that Unix shells devote special
attention to a <span class="firstterm">standard input</span> stream that forms the main input
to most programs/commands, and to a <span class="firstterm">standard output</span> stream that
forms the main output from most programs/commands.<a onmouseover="DBshowBriefly('fn_fref18_live')" name="fn_fref18" id="fn_fref18" class="footnotemark" href="#fn_fnote18">18</a><div class="footnote_live" id="fn_fref18_live">There is
actually a second output stream supported by many programs, the <span class="firstterm">standard error</span> stream, used for writing error/debugging messages.</div>
The shell attempts to make it easy either to <span class="firstterm">redirect</span> one of
these standard streams to a file or to <span class="firstterm">pipe</span> the standard output
stream of one program into the standard input of another.</p><div class="sect3" id="redirect"><div class="info_sect3"><div class="title_sect4">2.3.1. Redirection</div></div>
    
    <p class="para">For example, the program <span class="code">wc</span> (for <span class="emphasis-bold" role="bold">w</span>ord <span class="emphasis-bold" role="bold">c</span>ount) reads
text from its input stream and produces as its output stream three
numbers indicating the number of lines, words, and characters that it
saw. You could invoke this directly:
<div class="programlisting">
   wc
   Hello.
   How are you?
   ^D
</div>
in  which case, you would see as output:
<div class="screen"><span class="computeroutput">
     2     4    20
</span></div>
For this to be very useful, however, we need to make it accept a file
as input. This is done by using the <span class="code">&lt;</span> operator in the shell.
Think of the <span class="code">&lt;</span> as an arrow indicating data flowing towards the
command from a filename:
If <span class="code">hello.c</span> is this file:
<div class="programlisting">
#include &lt;stdio.h&gt; 
int main () 
{
  printf ("Hello from C!\n"); 
  return 0;
}
</div>
then the command
<div class="screen"><span class="userinput">
wc &lt; hello.c
</span></div>
produces the output 
<div class="screen"><span class="computeroutput">
     6    13    80
</span></div></p>
    <p class="para">On the output end, the shell operator <span class="code">&gt;</span> redirects the standard
output into a file (again, think of this as an arrow indicating data
flowing into a filename from the command):
<div class="screen"><span class="userinput">
wc &lt; hello.c &gt; hello.wc
</span></div>
produces no output on the screen, but creates a file called
<span class="code">hello.wc</span>. That file will contain the output 
<div class="screen"><span class="computeroutput">
     6    13    80
</span></div>
of the <span class="code">wc</span> command.</p>
    <p class="para">The output redirection operator has a couple of important variants.
First, the shell generally does not allow you to redirect into an
existing file. If you give the command
<div class="screen"><span class="userinput">
   wc &lt; hello.c &gt; hello.wc
</span></div>
a second time, the shell will refuse to perform the command.
You can force the shell to delete an existing file and create a new
one for redirection by changing the <span class="code">&gt;</span> to <span class="code">&gt;!</span>.</p>

<div class="informalexample"><div class="title_example">Try This:</div><div class="programlisting">   cd ~/playing
echo Hello &gt; greeting.txt
more greeting.txt
echo Goodbye &gt; greeting.txt
more greeting.txt
echo Farewell &gt;! greeting.txt
more greeting.txt
</div></div>

    <p class="para">Second, sometimes we would like to add output to the end of an
existing file instead of replacing that file. This is done with the
operator <span class="code">&gt;&gt;</span>. So the code sequence
<div class="programlisting">
   wc &lt; hello.c &gt;! hello.wc
   wc &lt; hello.c &gt;&gt; hello.wc
</div>
would result in a file <span class="code">hello.wc</span> with contents
<div class="screen"><span class="computeroutput">
     6    13    80
     6    13    80
</span></div>
regardless of whether <span class="code">hello.wc</span> had existed previously.</p>

<div class="informalexample"><div class="title_example">Try This:</div><div class="programlisting">   cd ~/playing
echo Aloha &gt;&gt; greeting.txt
more greeting.txt
</div></div>



  </div><div class="sect3" id="piping"><div class="info_sect3"><div class="title_sect4">2.3.2. Pipes</div></div>
    
    <p class="para">To pipe the output of one command into the input of another, use the
shell operator <span class="code">|</span>. A common example of a pipe is to take a
command that may have a large amount of output and to pipe it through
<span class="code">more</span> to facilitate viewing.
<div class="informalexample"><div class="title_example">Try This:</div><div class="programlisting">   ls /bin | more
</div></div>
</p>

    <p class="para"> As you gain facility with a greater variety of Unix text manipulation
commands, you will find that redirection and pipes can be a powerful
combination. For example, suppose that you have written program
<span class="code">myprog</span> that emits a great deal of output, among which might be
some error messages starting with the phrase <span class="quote">
      &#8220;<span class="code">ERROR:</span>&#8221;
    </span>. If you
wanted to read only the error messages, you could, of course, just
view <span class="emphasis">all</span> the output, watching for the occasional error message:
<div class="screen"><span class="userinput">
   myprog | more
</span></div>
But if the program produces a lot of output, this will quickly become
tedious. However, we previously encountered the program <span class="code">grep</span>,
which scans its input stream, printing only
those lines matching a given regular expression.
By piping the <span class="code">myprog</span> output through <span class="code">grep</span>, we can limit the output to the
part we really want to see:
<div class="screen"><span class="userinput">
   myprog | grep "ERROR:" | more
</span></div></p>
  </div><p class="para">Redirection allows you to alter the behavior of individual commands by changing where they get their input and where they store their output. Pipes allow you to combine commands in interesting ways. Next we will look at a pair of commands that also let you combine selective inputs and combinations of commands. These two commands, <span class="code">xargs</span> and <span class="code">find</span>, are interesting inpart  because they allow you to issue other commands from them.
  </p><div class="sect3" id="xargs"><div class="info_sect3"><div class="title_sect4">2.3.3. xargs</div></div>
    

    <p class="para">
      <span class="code">xargs</span> reads a list of file names from the standard
      input and fills those file names in to a command of your
      choosing.  In its simplest form, you can use <span class="code">xargs</span>
      like this:
<div class="programlisting">xargs <span class="emphasis">partial-command</span>
</div>
      In this form <span class="code">xargs</span> will read a list of file names
      (paths) from the standard input and will simply tack them on to
      the end of the partial command.
    </p>
    <p class="para">
      Where do the file names come from? You're not likely to type
      them directly at the keyboard. (If you were going to do that,
      you would probably just have typed the whole command.) So,
      usually, you will run this with a list of files names that you
      have collected into a text file, or you may pipe into
      <span class="code">xargs</span> the output of a
      command that lists the files you want.
      <div class="informalexample"><div class="title_example">Try This:</div><div class="programlisting">ls /bin
ls /bin | xargs echo Issuing a command on
</div><p class="para">
	Most command shells will have limits on just how long a single
	command can get, and <span class="code">xargs</span> tries to be smart about
	the way it constructs commands. If the standard input contains
	a very large number of files, <span class="code">xargs</span> will break the
	list up into pieces. Look at the output above. Can you see
	evidence that <span class="code">xargs</span> has split the list into
	separate commands?
      </p></div>
    </p>

    <p class="para">
      You can control the maximum number of files that
      <span class="code">xargs</span> will pack into one command using the
      <span class="code">-n</span> flag.
      <div class="informalexample"><div class="title_example">Try This:</div><div class="programlisting">ls /bin | xargs -n 4 echo Issuing a command on
</div></div>
      The most common reason for doing this is because not all Unix
      commands work on arbitrarily long lists of files. Some work only
      on a single file, making <span class="code">-n 1</span> a useful option.
    </p>

    <p class="para">
      In this basic form, <span class="code">xargs</span> tacks the file names onto
      the end of the generated command. But sometimes you might want
      the filenames placed into the middle of the command. The
      <span class="code">-i</span> option permits that. If <span class="code">xargs</span>is
      executed with a <span class="code">-i</span> flag, then it looks in your
      partial command for the characters <span class="quote">
      &#8220;{}&#8221;
    </span> and places
      your files there (one at a time, as if you had said <span class="quote">
      &#8220;<span class="code">-n 1</span>&#8221;
    </span>.
      <div class="informalexample"><div class="title_example">Try This:</div><div class="programlisting">ls /bin | xargs -i echo Hello {} world
</div></div>
    </p>

    <p class="para">
      As an example of using <span class="code">xargs</span>, suppose that you have
      a directory with a large number of data files. You want to copy
      those files into a new directory. However, you have edited many
      of these files, so the original directory is littered with
      backup files left by the editors. You would prefer not to copy
      those backups. The backups can be recognized because some end in
      <span class="quote">
      &#8220;<span class="code">.bak</span>&#8221;
    </span> and some end in
      <span class="quote">
      &#8220;<span class="code">~</span>&#8221;
    </span>.
    </p>
    <p class="para">
      Now, normally, you would copy files from one directory to
      another like this:
<div class="programlisting">cp <span class="emphasis">oldDirectory</span>/* <span class="emphasis">newDirectory</span>/
</div>
But there is not obvious way to rewrite the wildcard pattern
<span class="code">*</span> to exclude the backup files (wildards are great for
including things, not so great for excluding them).
    </p>

    <p class="para">But a list of file names is nothing more than text, and we
    have some powerful tools like <span class="code">grep</span> for editing and
    selecting text.
    </p>

      <div class="informalexample"><div class="title_example">Try This:</div><div class="programlisting">mkdir ~/xargs
cd ~cs252/Assignments/xargs
ls
ls | grep -v '\.bak$'
ls | grep -v '\.bak$' | grep -v '~$'
ls | grep -v '\.bak$' | grep -v '~$' | xargs -i cp {} ~/xargs
ls ~/xargs
</div></div>


  </div><div class="sect3" id="find"><div class="info_sect3"><div class="title_sect4">2.3.4. find</div></div>
    

    <p class="para">
      Wildcards give us a useway to describe a number of files at
      once. But wildcards have a limitation. They can only describe
      one "level" of directories at a time. You can write a wildcard
      expression to look at a variety of files in one directory, or at
      a variety of files in one or more subdirectories of that
      directory, or in one or more sub-subdirectories of that one. But
      you cannot write a wildcard expression that will simultaneously
      describe files in a directory and in its subdirectories.
    </p>

    <p class="para">
      Some commands will try to help with this. Both <span class="code">cp</span>
      and <span class="code">rm</span>, for example, offer a <span class="code">-r</span> flag
      (<span class="quote">
      &#8220;r&#8221;
    </span> for <span class="quote">
      &#8220;recursive&#8221;
    </span>) that will
      descend into an arbitrary number of levels of subdirectories,
      but these are all-or-nothing selections. You can't be very
      selective about  what files get processed this way.
    </p>

    <p class="para">
      This is where <span class="code">find</span> come in. <span class="code">find</span> is
      the Swiss army knife of Unix commands. It provides all kinds of
      ways to select files, no matter how deep they are in your
      directory structure. It provides a variety of things it can do
      with selected files, or it can fill their names into an
      arbitrary command in a manner similar to <span class="code">xargs -i</span>.
    </p>

    <p class="para">
      The general form of a <span class="code">find</span> command is
<div class="programlisting">find <span class="emphasis">list-of-files-and-directories</span> <span class="emphasis">list-of-actions</span>
</div>
       <span class="code">find</span> looks at each file and directory given in the
       list. For directories, it also looks at all files and
       directories inside those, descending as far as it can from
       directory to directory.
    </p>
    <p class="para">The <span class="emphasis">actions</span> in the command are all
    given a flags (beginning with <span class="quote">
      &#8220;-&#8221;
    </span>). Some actions will
    <span class="quote">
      &#8220;do something&#8221;
    </span> to a file. Others are used to select
    which files will be passed on to the later commands in the list.
    </p>

      <div class="informalexample"><div class="title_example">Try This:</div><div class="programlisting">ls /usr/include
find /usr/include
</div></div>
         <p class="para">
	   The most common selection action is <span class="code">-name</span>,
	   which is given a wildcard expression to match file names
	   against.
	 </p>
      <div class="informalexample"><div class="title_example">Try This:</div><div class="programlisting">ls /usr/include/w*.h
ls /usr/include/*/w*.h
find /usr/include -name 'w*.h'
</div><p class="para">
	   The wildcard expression for  <span class="code">-name</span> must be
	   quoted, because you don't want the command shell to expand
	   it before it launches <span class="code">find</span>.
	 </p></div>

      <p class="para">
	Other useful ways to select files include
	<span class="code">-type</span>, which chooses different "types" of
	files. Directories are type 'd' and ordinary files are type
	'f'.
      </p>
      <div class="informalexample"><div class="title_example">Try This:</div><div class="programlisting">find /usr/include -type d -name 'u*'
find /usr/include -type d -name 'u*' -ls
</div><div class="programlisting">
find /usr/include -type f -name 'u*'
</div></div>
      <p class="para">You can also select files based on how long ago they were
      modified.
      <div class="informalexample"><div class="title_example">Try This:</div><div class="programlisting">find ~ -mtime +7
find ~ -mtime -7
</div><p class="para">
  One of these lists only files you have modified within the past 7
  days. The other lists files whose last modification is more than 7
  days in the past.
</p><p class="para">Not sure which is which? Try</p><div class="programlisting">find ~ -mtime +7 | xargs ls -ld
find ~ -mtime -7 | xargs ls -ld
</div></div>
      </p>

      <p class="para">
	What can <span class="code">find</span> <span class="emphasis">do</span> to files it
	selects? The simplest possibility if to simply print the file
	name, which is done by the action
	<span class="quote">
      &#8220;<span class="code">-print</span>&#8221;
    </span>. In fact, that's the
	behavior we have seen in all the examples so far, because it's
	the default if you don't do anything else to the selected
	files. Sometimes, though, you use <span class="code">-print</span> because
	you wnat to print a file name <span class="emphasis">and</span> do
	something else to a file.
      </p>

      <p class="para">You can get a bit more information than just the name:
      <div class="informalexample"><div class="title_example">Try This:</div><div class="programlisting">find ~ -mtime +7 -ls
</div></div>
      </p>

      <p class="para">The most powerful use of <span class="code">find</span> comes form the
      <span class="code">-exec</span> action, which allows you to specify an
      arbitrary Unix command that you want applied to selected
      files. The command is terminated by a quoted semi-colon
      (<span class="quote">
      &#8220;\;&#8221;
    </span>) and should contain the characters
      <span class="quote">
      &#8220;{}&#8221;
    </span> at the point where you want to insert the file
      name.
      </p>
      <div class="informalexample"><div class="title_example">Try This:</div><div class="programlisting">cp ~cs252/Assignments/xargs/* ~/xargs
ls ~/xargs
find ~/xargs -name '*.bak' -print -exec rm {} \;
ls ~/xargs
</div></div>
      <p class="para">
	Closely related is <span class="code">-ok</span>, which asks for permission
	before applying a command.
      <div class="informalexample"><div class="title_example">Try This:</div><div class="programlisting">ls ~/xargs
find ~/xargs -name '*~' -ok rm {} \;
ls ~/xargs
</div></div>
      </p>

      <p class="para">Actually, because many commands, such as
      <span class="code">grep</span>, can be used to test files for certain
      properties, <span class="code">-exec</span> can actually be used to select
      files as well as to operate on them.
      <div class="informalexample"><div class="title_example">Try This:</div><div class="programlisting">find /usr/include -type f -exec grep --quiet math {} \; -ls
</div></div>
      </p>


      <p class="para">
	There are many other possible actions as well. See the
	<span class="code">man</span> page for details.
      </p>



  </div><div name="fn_fnote18" id="fn_fnote18" class="footnote">18. There is
actually a second output stream supported by many programs, the <span class="firstterm">standard error</span> stream, used for writing error/debugging messages. (<a href="#fn_fref18">back</a>)
    </div></div><script type="text/javascript">
checkForAnchorOnOtherPage('section-2.4','section-2.4');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('section-2.4.1','section-2.4');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref19','section-2.4');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref19_live','section-2.4');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fnote19','section-2.4');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('section-2.4.2','section-2.4');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref20','section-2.4');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref20_live','section-2.4');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fnote20','section-2.4');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('umask','section-2.4');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('section-2.4.4','section-2.4');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('section-3','section-3');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('vim','section-3');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref21','section-3');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref21_live','section-3');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('section-3.1','section-3.1');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('section-3.2','section-3.2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('section-3.3','section-3.3');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('markregion','markregion');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref22','markregion');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref22_live','markregion');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fnote22','markregion');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('section-3.5','section-3.5');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('section-3.6','section-3.6');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fnote21','section-3.6');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('section-4','section-4');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('section-4.1','section-4');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('section-4.1.1','section-4');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('twin','section-4');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('icewin','section-4');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('starwin','section-4');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('connections','section-4');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('runningx','section-4');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref23','section-4');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref23_live','section-4');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('launchTheServer','section-4');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('creatingsession','section-4');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('section-4.1.2.1.2','section-4');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('section-4.1.2.1.3','section-4');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref24','section-4');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref24_live','section-4');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fnote24','section-4');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('section-4.1.2.1.4','section-4');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref25','section-4');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref25_live','section-4');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fnote25','section-4');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('launchClient','section-4');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref26','section-4');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref26_live','section-4');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('launchViaSsh','section-4');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref27','section-4');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref27_live','section-4');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fnote27','section-4');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('launchViaPutty','section-4');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref28','section-4');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref28_live','section-4');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fnote28','section-4');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('xlaunch-sessions','section-4');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('xwin32-sessions','section-4');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref29','section-4');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref29_live','section-4');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fnote29','section-4');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fnote26','section-4');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fnote23','section-4');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('section-4.1.3','section-4');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('xappl','section-4');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('xtrouble','section-4');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('cannotOpen','section-4');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('firewall','section-4');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref30','section-4');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref30_live','section-4');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref31','section-4');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref31_live','section-4');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref32','section-4');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref32_live','section-4');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fnote30','section-4');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fnote31','section-4');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fnote32','section-4');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('xforwarding','section-4');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('xfast','section-4');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('section-4.1.5.4.1','section-4');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('section-4.1.5.4.2','section-4');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('xtermFont','section-4');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('connect-localhost','section-4');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('refusedByServer','section-4');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('alternatives','section-4');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('RDP','section-4');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('vnc','section-4');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('vncx','section-4');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('section-4.2','section-4.2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('emacsinx','section-4.2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('emacsintelnet','section-4.2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('section-5','section-5');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('section-5.1','section-5');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('section-5.1.1','section-5');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('section-5.1.2','section-5');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('mailcommand','section-5');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('mailsend','section-5');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('section-5.1.3.2','section-5');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref33','section-5');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref33_live','section-5');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fnote33','section-5');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('popmail','section-5');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('section-5.2','section-5.2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('pinemain','section-5.2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('pinecompose','section-5.2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('pineindex','section-5.2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('section-6','section-6');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('xfermode','xfermode');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('xfersamba','xfersamba');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref34','xfersamba');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref34_live','xfersamba');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fnote34','xfersamba');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('internetftp','internetftp');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('anonprivateftp','internetftp');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref35','internetftp');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref35_live','internetftp');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fnote35','internetftp');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('ftpclient','internetftp');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref36','internetftp');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref36_live','internetftp');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref37','internetftp');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref37_live','internetftp');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fnote36','internetftp');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fnote37','internetftp');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('xferproblems','xferproblems');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('dostounix','xferproblems');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('unixtodos','xferproblems');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('section-7','section-7');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('section-7.1','section-7');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('section-7.1.1','section-7');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('compshell','section-7');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref38','section-7');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref38_live','section-7');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('cStructure','section-7');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref39','section-7');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref39_live','section-7');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fig:compilation','section-7');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('section-7.1.1.1.1.1','section-7');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('section-7.1.1.1.1.2','section-7');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fnote39','section-7');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('compilingSingle','section-7');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('compilingMultiple','section-7');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('compilerOptions','section-7');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref40','section-7');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref40_live','section-7');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref41','section-7');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref41_live','section-7');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fnote40','section-7');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fnote41','section-7');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fnote38','section-7');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('errmsgs','section-7');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('capturing','section-7');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref42','section-7');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref42_live','section-7');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fnote42','section-7');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('understanding','section-7');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('javacomp','section-7');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref43','section-7');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref43_live','section-7');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('jproject','section-7');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fnote43','section-7');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('section-7.1.1.4','section-7');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('emacserr','section-7');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('emacs-next-error','section-7');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref44','section-7');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref44_live','section-7');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fnote44','section-7');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('vimcompile','section-7');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('vimscreen','section-7');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('section-7.1.2','section-7');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref45','section-7');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref45_live','section-7');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('section-7.1.2.1','section-7');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('section-7.1.2.2','section-7');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('artificial-targets','section-7');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('writingMakefiles','section-7');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('section-7.1.2.5','section-7');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fnote45','section-7');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('section-7.1.3','section-7');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('section-7.1.3.1','section-7');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref46','section-7');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref46_live','section-7');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref47','section-7');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref47_live','section-7');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fnote46','section-7');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fnote47','section-7');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('section-7.1.3.2','section-7');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('section-7.1.3.3','section-7');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('gdbmode','section-7');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref48','section-7');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref48_live','section-7');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref49','section-7');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref49_live','section-7');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fnote48','section-7');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fnote49','section-7');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('section-7.2','section-7.2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('section-7.2.1','section-7.2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('section-7.2.2','section-7.2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('gdbxfig','section-7.2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('dddfig','section-7.2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('section-8','section-8');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('section-8.1','section-8');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref50','section-8');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref50_live','section-8');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('loginCustom','section-8');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref51','section-8');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref51_live','section-8');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref52','section-8');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref52_live','section-8');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fnote51','section-8');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fnote52','section-8');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('xCustom','section-8');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('programCustom','section-8');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fnote50','section-8');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('section-8.2','section-8.2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('section-8.2.1','section-8.2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('controlflow','section-8.2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref53','section-8.2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fref53_live','section-8.2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('fn_fnote53','section-8.2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('section-8.2.3','section-8.2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('section-8.2.4','section-8.2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('section-8.2.4.1','section-8.2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('section-8.2.4.2','section-8.2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('scriptDebugging','section-8.2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('section-8.2.5.1','section-8.2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('section-8.2.5.2','section-8.2');
</script><script type="text/javascript">
checkForAnchorOnOtherPage('tracing','section-8.2');
</script><br/><table width="100%" class="navigationBar"><tr class="navigationBar"><td width="5%" class="navigationBar"><a class="navigationBarArrow" title="First" href="http://cocoon.cs.odu.edu:80/cocoon/~cs252/open/unix/unix.html"><img class="navigationBar" src="_axle/first.gif" alt="First"/></a></td><td width="5%" class="navigationBar"><a class="navigationBarArrow" title="Prev" href="http://cocoon.cs.odu.edu:80/cocoon/~cs252/open/unix/section-2.2.html"><img class="navigationBar" src="_axle/prev.gif" alt="Prev"/></a></td><td width="5%" class="navigationBar"><a class="navigationBarArrow" title="Up" href="http://cocoon.cs.odu.edu:80/cocoon/~cs252/open/unix/section-2.html"><img class="navigationBar" src="_axle/up.gif" alt="Up"/></a></td><td width="5%" class="navigationBar"><a class="navigationBarArrow" title="Next" href="http://cocoon.cs.odu.edu:80/cocoon/~cs252/open/unix/section-2.4.html"><img class="navigationBar" src="_axle/next.gif" alt="Next"/></a></td><td width="5%" class="navigationBar"><a class="navigationBarArrow" title="Last" href="http://cocoon.cs.odu.edu:80/cocoon/~cs252/open/unix/section-8.2.html"><img class="navigationBar" src="_axle/last.gif" alt="Last"/></a></td><td class="navigationBar"/><td width="5%" class="navigationBar"><a class="navigationBar" title="CS252 Home" href="http://cocoon.cs.odu.edu:80/cocoon/~cs252/directory/announcements.html"><img class="navigationBar" src="_axle/home.gif" alt="CS252 Home"/></a></td><td width="5%" class="navigationBar"><a class="navigationBar" title="discuss this page" href="http://cocoon.cs.odu.edu:80/cocoon/~cs252/forum/getXPath/open/unix/section-2.3.html"><img class="navigationBar" src="_axle/forum.gif" alt="discuss this page"/></a></td></tr></table></body></html>