Linux Commands Reference - Complete Linux Command Guide

Comprehensive Linux command reference with 150+ commands. Search, filter by category, and view detailed usage examples.

Share
Back to commands

ar

Create and manage archives (static libraries)

Syntax

ar [OPTION]... ARCHIVE [FILE]...

Common Options

rInsert or replace files
cCreate archive
tList archive contents
xExtract from archive
dDelete from archive
sCreate index
vVerbose output
uUpdate only newer files

Common Examples

ar rcs libfoo.a foo.o bar.o

Create static library

ar -t libfoo.a

List library contents

ar -x libfoo.a foo.o

Extract object file

ar -d libfoo.a old.o

Delete from library

ar -rv libfoo.a new.o

Add file to library

ar -s libfoo.a

Update library index

Related Commands

Related Tools

More Code & Dev Tools