home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam  


ar

/usr/ccs/bin/ar [-V ] key [args ] [posname ] 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 may be used, but each can 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 . See lorder in Appendix B, Obsolete Commands , for another example. -V prints the version number of ar on standard error.

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

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 .

Args

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.

C

Don't replace existing files of the same name with the one extracted from the archive. Useful with T . Solaris only.

i

Same as b .

s

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

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 only.

u

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

v

Verbose; print a description.

Example

Update the versions of object files in mylib.a with the ones in the current directory. Any files in mylib.a that are not in the current directory are not replaced.

ar r mylib.a *.o


Previous: Reference: apropos UNIX in a Nutshell: System V Edition Next: Reference: as
Reference: apropos Book Index Reference: as

The UNIX CD Bookshelf NavigationThe UNIX CD BookshelfUNIX Power ToolsUNIX in a NutshellLearning the vi Editorsed & awkLearning the Korn ShellLearning the UNIX Operating System