<html lang="en">
<head>
<title>ar - GNU Binary Utilities</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="GNU Binary Utilities">
<meta name="generator" content="makeinfo 4.8">
<link title="Top" rel="start" href="index.html#Top">
<link rel="prev" href="index.html#Top" title="Top">
<link rel="next" href="nm.html#nm" title="nm">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
@import url("../raisonance.css");
  pre.display { font-family:inherit }
  pre.format  { font-family:inherit }
  pre.smalldisplay { font-family:inherit; font-size:smaller }
  pre.smallformat  { font-family:inherit; font-size:smaller }
  pre.smallexample { font-size:smaller }
  pre.smalllisp    { font-size:smaller }
  span.sc    { font-variant:small-caps }
  span.roman { font-family:serif; font-weight:normal; } 
  span.sansserif { font-family:sans-serif; font-weight:normal; } 
--></style>
</head>
<body>
<div class="node">
<p>
<a name="ar"></a>
Next:&nbsp;<a rel="next" accesskey="n" href="nm.html#nm">nm</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="index.html#Top">Top</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="index.html#Top">Top</a>
<hr>
</div>

<h2 class="chapter">1 ar</h2>

<p><a name="index-ar-2"></a><a name="index-archives-3"></a><a name="index-collections-of-files-4"></a>
<!-- man title ar create, modify, and extract from archives -->

<pre class="smallexample">     ar [-]<var>p</var>[<var>mod</var> [<var>relpos</var>] [<var>count</var>]] <var>archive</var> [<var>member</var>...]
     ar -M [ &lt;mri-script ]
</pre>
   <!-- man begin DESCRIPTION ar -->
<p>The <span class="sc">gnu</span> <samp><span class="command">ar</span></samp> program creates, modifies, and extracts from
archives.  An <dfn>archive</dfn> is a single file holding a collection of
other files in a structure that makes it possible to retrieve
the original individual files (called <dfn>members</dfn> of the archive).

   <p>The original files' contents, mode (permissions), timestamp, owner, and
group are preserved in the archive, and can be restored on
extraction.

   <p><a name="index-name-length-5"></a><span class="sc">gnu</span> <samp><span class="command">ar</span></samp> can maintain archives whose members have names of any
length; however, depending on how <samp><span class="command">ar</span></samp> is configured on your
system, a limit on member-name length may be imposed for compatibility
with archive formats maintained with other tools.  If it exists, the
limit is often 15 characters (typical of formats related to a.out) or 16
characters (typical of formats related to coff).

   <p><a name="index-libraries-6"></a><samp><span class="command">ar</span></samp> is considered a binary utility because archives of this sort
are most often used as <dfn>libraries</dfn> holding commonly needed
subroutines.

   <p><a name="index-symbol-index-7"></a><samp><span class="command">ar</span></samp> creates an index to the symbols defined in relocatable
object modules in the archive when you specify the modifier `<samp><span class="samp">s</span></samp>'. 
Once created, this index is updated in the archive whenever <samp><span class="command">ar</span></samp>
makes a change to its contents (save for the `<samp><span class="samp">q</span></samp>' update operation). 
An archive with such an index speeds up linking to the library, and
allows routines in the library to call each other without regard to
their placement in the archive.

   <p>You may use `<samp><span class="samp">nm -s</span></samp>' or `<samp><span class="samp">nm --print-armap</span></samp>' to list this index
table.  If an archive lacks the table, another form of <samp><span class="command">ar</span></samp> called
<samp><span class="command">ranlib</span></samp> can be used to add just the table.

   <p><a name="index-compatibility_002c-_0040command_007bar_007d-8"></a><a name="index-g_t_0040command_007bar_007d-compatibility-9"></a><span class="sc">gnu</span> <samp><span class="command">ar</span></samp> is designed to be compatible with two different
facilities.  You can control its activity using command-line options,
like the different varieties of <samp><span class="command">ar</span></samp> on Unix systems; or, if you
specify the single command-line option <samp><span class="option">-M</span></samp>, you can control it
with a script supplied via standard input, like the MRI &ldquo;librarian&rdquo;
program.

<!-- man end -->
<ul class="menu">
<li><a accesskey="1" href="ar-cmdline.html#ar-cmdline">ar cmdline</a>:                   Controlling <samp><span class="command">ar</span></samp> on the command line
<li><a accesskey="2" href="ar-scripts.html#ar-scripts">ar scripts</a>:                   Controlling <samp><span class="command">ar</span></samp> with a script
</ul>

   </body></html>

