Name

ar

Synopsis

    ar key [args] [posname] [count] archive[files]

Maintain a group of files that are combined into a file archive. Used most commonly to create and update library files as used by the loader (ld). Only one key letter can be used, but each may be combined with additional args (with no separations between). posname is the name of a file in archive. When moving or replacing files, you can specify that they be placed before or after posname.

On all three systems, key and args can be preceded with a -, as though they were regular options.

Solaris: ar is found in /usr/ccs/bin.

Key

d

Delete files from archive.

m

Move files to end of archive.

p

Print files in archive.

q

Append files to archive.

r

Replace files in archive.

t

List the contents of archive or list the named files.

x

Extract contents from archive or only the named files.

Common Arguments

a

Use with r or m to place files in the archive after posname.

b

Same as a but before posname.

c

Create archive silently.

i

Same as b.

s

Force regeneration of archive symbol table (useful after running strip).

u

Use with r to replace only files that have changed since being put in archive.

v

Verbose; print a description.

Solaris and GNU/Linux Argument

V

Print version number.

Solaris and Mac OS X Argument

T

Truncate long filenames when extracting onto filesystems that don’t support long filenames. Without this operation, extracting files with long filenames is an error.

Solaris ...

Get Unix in a Nutshell, 4th Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.