ar - create library archives, and add or extract files
ar d | m | p | q | r | t | x [ [ clouv ] [ abi position-name ] ] ar-
chive [ member-file... ]
SYSTEM V SYNOPSIS
/usr/5bin/ar [-] d | m | p | q | r | t | x [ [ clouvs ] [ abi position-
name ] ] archive [ member-file... ]
The System V version of this command is available with the System V
software installation option. Refer to for information on how to
install optional software.
ar maintains groups of files combined into a single archive file. An
archive file comprises a set of member files and header information for
each file. The archive header and the headers for the file consist of
printable characters (assuming that the names of the files in the ar-
chive contain printable characters), and are in a format portable
across all machines. This format is described in detail in ar(5)). If
an archive is composed of printable files, with printable file names,
the entire archive is printable.
ar is normally used to create and update library files used by the link
editor ld(1), but can be used for any similar purpose.
archive is the name of the archive file. member-file is a member file
contained in the archive. If this argument is omitted, the command
applies to all entries in the archive. Member names have a maximum of
15 characters, except on Sun386i systems, where they have a maximum of
14 characters, longer names are truncated.
SYSTEM V DESCRIPTION
ar runs ranlib after modifying an archive, so that the symbol table
member of the archive is kept up-to-date.
You must indicate only one of: d, m, p, q, r, t, or x, which may be
followed by one or more Modifiers.
d Delete the named files from the archive file.
m Move the named files to the end of the archive.
p Print. If no names are given, all files in the archive are writ-
ten to the standard output; if no names are given, only those
files are written, and they are written in the order that they
appear in the archive.
q Quick append. Append the named files to the end of the archive
file without searching the archive for duplicate names. Useful
only to avoid quadratic behavior when creating a large archive
piece-by-piece. If this option is used to add a member to an
archive, and a member with the same name as that member already
exists in the archive, the old member will not be removed; two
members with the same name will exist in the archive.
r Replace the named files in the archive.
t Table of contents. If no names are given, all files in the ar-
chive are listed; if names are given, only those files are
x Extract. If no names are given, all files in the archive are
extracted into the current directory; if names are given, only
those files are extracted. In neither case does x alter the ar-
c Create. Suppress the message that is produced by default when
archive is created.
l Local. Place temporary files in the current working directory
rather than in the default temporary directory, /tmp.
o Old date. When files are extracted with the x option, set the
``last modified'' date to the date recorded in the archive.
u Update. Replace only those files that have changed since they
were put in the archive. Used with the r option.
v Verbose. When used with the r, d, m, or q option, give a file-
by-file description of the creation of a new archive file from
the old archive and the constituent files. When used with x,
give a file-by-file description of the extraction of archive
files. When used with t, give a long listing of information
about the files. When used with p, write each member's name to
the standard output before writing the member to the standard
Place new files after position-name (position-name argument must
be present). Applies only to the r and m options.
Place new files before position-name (position-name argument
must be present). Applies only to the r and m options.
Identical to the b modifier.
SYSTEM V OPTIONS
The options may be preceded by `-'.
s Force the regeneration of the archive symbol table even if ar is
not invoked with a command that will modify the archive con-
Creating a new archive:
example% ar rcv archive file.o
a - file.o
Adding to an archive:
example% ar rav file.o archive next.c
a - next.c
Extracting from an archive:
example% ar xv archive file.o
x - file.o
example% ls file.o
Seeing the table of contents:
example% ar t archive
/tmp/v*. temporary files
ld(1), lorder(1), ranlib(1), ar(5)
If the same file is mentioned twice in an argument list, it is put in
the archive twice.
The ``last-modified'' date of a file will not be altered by the o
option unless the user is either the owner of the extracted file or the
18 February 1988 AR(1V)