Linux "ar" Command Line Options and Examples
create, modify, and extract from archives

The GNU ar program creates, modifies, and extracts from archives. An archive is a single file holding a collection of other files in a structure that makes it possible to retrieve the original individual files (called members of the archive).


ar [-X32_64] [-]p[mod] [--plugin name] [--target bfdname] [relpos] [count] archive [member...]

Command Line Options:

Displays the list of command line options supported by ar and then exits.
ar --help ...
Displays the version information of ar and then exits.
ar --version ...
ar ignores an initial option spelt -X32_64, for compatibility with AIX. The behaviour produced by this option is the default forGNU ar. ar does not support any of the other -X options; in particular, it does not support -X32 which is the default for AIXar.
ar -X32_64 ...
The optional command line switch --plugin name causes ar to load the plugin called name which adds support for more file formats,including object files with link-time optimization information.This option is only available if the toolchain has been built with plugin support enabled.If --plugin is not provided, but plugin support has been enabled then ar iterates over the files in ${libdir}/bfd-plugins inalphabetic order and the first plugin that claims the object in question is used.Please note that this plugin search directory is not the one used by ld's -plugin option. In order to make ar use the linkerplugin it must be copied into the ${libdir}/bfd-plugins directory. For GCC based compilations the linker plugin is For Clang based compilations it is called The GCC plugin is always backwards compatiblewith earlier versions, so it is sufficient to just copy the newest one.
ar --plugin ...
The optional command line switch --target bfdname specifies that the archive members are in an object code format different fromyour system's default format. See@fileRead command-line options from file. The options read are inserted in place of the original @file option. If file does notexist, or cannot be read, then the option will be treated literally, and not removed.Options in file are separated by whitespace. A whitespace character may be included in an option by surrounding the entireoption in either single or double quotes. Any character (including a backslash) may be included by prefixing the character to beincluded with a backslash. The file may itself contain additional @file options; any such options will be processed recursively.
ar --target ...