ar(1) ar(1)
NAME
ar - archive and library maintainer for portable archives
SYNOPSIS
ar key[[clsuv][abi posname] afile name ...
DESCRIPTION
ar maintains groups of files combined into a single archive
file. Its main use is to create and update library files as
used by the link editor. It can be used, though, for any
similar purpose.
When ar creates an archive, it creates headers in a format
that is portable across all machines. The portable archive
format and structure are described in detail in ar(4). The
archive symbol table (described in ar(4)) is used by the
link editor (ld(1)) to effect multiple passes over libraries
of object files in an efficient manner. Whenever the ar(1)
command is used to create or update the contents of an
archive, the symbol table is rebuilt. The symbol table can
be forced to be rebuilt by the s option, described below.
key is one character from the set dmpqrtx. key may
optionally be concatenated with one or more of clsuv or abi.
afile is the archive file. The names are constituent files
in the archive file. The meanings of the key characters
are:
d Delete the named files from the archive file.
r Replace the named files in the archive file. If the
optional character u is used with r, then only those
files with modified dates later than the archive files
are replaced. If an optional positioning character
from the set abi is used, then the posname argument
must be present and specifies that new files are to be
placed after (a) or before (b or i) posname.
Otherwise, new files are placed at the end.
q Quickly append the named files to the end of the
archive file. Optional positioning characters are
invalid. The command does not check whether the added
members are already in the archive. Useful only to
avoid quadratic behavior when creating a large archive
piece-by-piece.
t Print a table of contents of the archive file. If no
names are given, all files in the archive are tabled.
If names are given, only those files are tabled.
p Print the named files in the archive.
Page 1 (last mod. 1/16/87)
ar(1) ar(1)
m Move the named files to the end of the archive. If a
positioning character is present, then the posname
argument must be present and, as in r, specifies where
the files are to be moved.
x Extract the named files. If no names are given, all
files in the archive are extracted. In neither case
does x alter the archive file.
v Verbose. Under the verbose flag option, ar gives a
file-by-file description of the making of a new archive
file from the old archive and the constituent files.
When used with t, it gives a long listing of all
information about the files. When used with x, it
precedes each file with a name.
c Create. Normally ar creates afile when it needs to.
The create flag option suppresses the normal message
that is produced when afile is created.
l Local. Normally ar places its temporary files in the
directory /tmp. This flag option causes them to be
placed in the local directory.
s Symbol table creation. Force the regeneration of the
archive symbol table even if ar(1) is not invoked with
a command which will modify the archive contents. This
command is useful to restore the archive symbol table
after the strip(1) command has been used on the
archive.
EXAMPLE
ar rc
creates an archive file.
FILES
/bin/ar
/tmp/ar*
SEE ALSO
ld(1), lorder(1), strip(1), a.out(4), ar(4).
BUGS
If the same file is mentioned twice in an argument list, it
may be put in the archive twice.
Page 2 (last mod. 1/16/87)