LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

ar

Create and manage static library archives

TLDR

Create archive from files
$ ar rcs [archive.a] [file1.o] [file2.o]
copy
List archive contents
$ ar t [archive.a]
copy
Extract all files
$ ar x [archive.a]
copy
Extract specific file
$ ar x [archive.a] [file.o]
copy
Add file to archive
$ ar r [archive.a] [newfile.o]
copy
Delete file from archive
$ ar d [archive.a] [file.o]
copy

SYNOPSIS

ar [-X3264] [-]operation[modifiers] archive [files_...]

DESCRIPTION

ar creates, modifies, and extracts from archives. It's primarily used to create static libraries (.a files) from object files for use with the linker.Archives contain multiple files with a table of contents for quick access. Unlike tar, ar is optimized for random access to individual members.

PARAMETERS

r

Insert (replace) files
c
Create archive
s
Create/update archive index (ranlib)
t
Table of contents
x
Extract files
d
Delete files
p
Print file contents to stdout
q
Quick append (no checking)
v
Verbose output
u
Update only newer files

INSTALL

sudo apt install binutils
copy
sudo dnf install binutils
copy
sudo pacman -S binutils
copy
sudo apk add binutils
copy
sudo zypper install binutils
copy
brew install binutils
copy
nix profile install nixpkgs#binutils
copy

CAVEATS

Primarily used for static libraries. For general archiving, use tar instead. Archive index (s) is needed for linker to use the library. No compression.

HISTORY

ar dates back to early Unix in the 1970s. It predates tar and was originally a general-purpose archiver before becoming specialized for library creation.

SEE ALSO

ranlib(1), nm(1), objdump(1), tar(1), ld(1)

Braincup
Open source brain training for math, memory and focus
Braincup mini-games
41 mini-games · Apache-2.0
No ads · No tracking
Play in browser
Download Braincup on the App StoreGet Braincup on Google PlayGet Braincup on F-Droid
276 stars
From the maker of Linux Command Library
Copied to clipboard
Braincup
Open source brain training for math, memory and focus. 41 mini-games, from mental arithmetic to Sudoku, N-Back and Solo Chess.
Apache-2.0 licensed · No ads · No tracking · No account
From the maker of Linux Command Library
Download Braincup on the App StoreGet Braincup on Google PlayGet Braincup on F-Droid