AR(1)
π AR(1) π
okay bestie, welcome to the ar manual page from the GNU Development Tools π this is the whole thing, and I'm gonna explain it to you like you're my favorite person in the group chat. no cap. π«Ά
π NAME π
ar β create, modify, and extract from archives β¨
πΈ SYNOPSIS πΈ
ar [-X32_64] [-]p[mod [relpos] [count]] archive [member...]
β¨ DESCRIPTION β¨
okay so the GNU ar program creates, modifies, and extracts from archives. and what is an archive, you ask? 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 β and those files inside are called members of the archive. π
the original files' contents, mode (permissions), timestamp, owner, and group are all preserved in the archive, and can be restored on extraction. it's giving time capsule, honestly. π
GNU ar can maintain archives whose members have names of any length. BUT β depending on how ar is configured on your system, a limit on member-name length may be imposed for compatibility with archive formats maintained with other tools. if that limit exists, it's often 15 characters (typical of formats related to a.out) or 16 characters (typical of formats related to coff). so likeβ¦ check before you name something my_super_long_filename.txt, bestie. π
ar is considered a binary utility because archives of this sort are most often used as libraries holding commonly needed subroutines. π¦
ar creates an index to the symbols defined in relocatable object modules in the archive when you specify the modifier s. once created, this index is updated in the archive whenever ar makes a change to its contents β save for the q update operation. an archive with such an index speeds up linking to the library, and allows routines in the library to call each other without regard to their placement in the archive. icon behavior. π
you may use nm -s or nm --print-armap to list this index table. and if an archive lacks the table, another form of ar called ranlib can be used to add just the table. slay, we love a specialist. β¨
GNU ar is designed to be compatible with two different facilities, and you get to pick your vibe:
- you can control its activity using command-line options, like the different varieties of
aron Unix systems β classic, reliable, we love her π - or, if you specify the single command-line option
-M, you can control it with a script supplied via standard input, like the MRI "librarian" program π
π OPTIONS π
GNU ar allows you to mix the operation code p and modifier flags mod in any order, within the first command-line argument. mix and match, bestie, it's your world π
if you wish, you may begin the first command-line argument with a dash. optional dash. we're chill like that. π
the p keyletter specifies what operation to execute; it may be any of the following, but you must specify only one of them:
π the operations (p)
dβ Delete modules from the archive. specify the names of modules to be deleted as member...; the archive is untouched if you specify no files to delete. if you specify thevmodifier,arlists each module as it is deleted. ποΈmβ Use this operation to move members in an archive. the ordering of members in an archive can make a difference in how programs are linked using the library, if a symbol is defined in more than one member. if no modifiers are used withm, any members you name in the member arguments are moved to the end of the archive; you can use thea,b, orimodifiers to move them to a specified place instead. πpβ Print the specified members of the archive, to the standard output file. if thevmodifier is specified, show the member name before copying its contents to standard output. if you specify no member arguments, all the files in the archive are printed. π¨οΈqβ Quick append. historically, add the files member... to the end of archive, without checking for replacement. the modifiersa,b, andido not affect this operation; new members are always placed at the end of the archive. the modifiervmakesarlist each file as it is appended. since the point of this operation is speed, the archive's symbol table index is not updated, even if it already existed; you can usear sorranlibexplicitly to update the symbol table index. HOWEVER β too many different systems assume quick append rebuilds the index, so GNUarimplementsqas a synonym forr. plot twist. πrβ Insert the files member... into archive (with replacement). this operation differs fromqin that any previously existing members are deleted if their names match those being added. if one of the files named in member... does not exist,ardisplays an error message, and leaves undisturbed any existing members of the archive matching that name. by default, new members are added at the end of the file; but you may use one of the modifiersa,b, orito request placement relative to some existing member. the modifiervused with this operation elicits a line of output for each file inserted, along with one of the lettersaorrto indicate whether the file was appended (no old member deleted) or replaced. β¨tβ Display a table listing the contents of archive, or those of the files listed in member... that are present in the archive. normally only the member name is shown; if you also want to see the modes (permissions), timestamp, owner, group, and size, you can request that by also specifying thevmodifier. if you do not specify a member, all files in the archive are listed. if there is more than one file with the same name (say,fie) in an archive (sayb.a),ar t b.a fielists only the first instance; to see them all, you must ask for a complete listing β in our example,ar t b.a. πxβ Extract members (named member) from the archive. you can use thevmodifier with this operation, to request thatarlist each name as it extracts it. if you do not specify a member, all files in the archive are extracted. π¦
a number of modifiers (mod) may immediately follow the p keyletter, to specify variations on an operation's behavior:
π¦ the modifiers (mod)
aβ Add new files after an existing member of the archive. if you use the modifiera, the name of an existing archive member must be present as the relpos argument, before the archive specification. πbβ Add new files before an existing member of the archive. if you use the modifierb, the name of an existing archive member must be present as the relpos argument, before the archive specification. (same asi). πΈcβ Create the archive. the specified archive is always created if it did not exist, when you request an update. but a warning is issued unless you specify in advance that you expect to create it, by using this modifier. πfβ Truncate names in the archive. GNUarwill normally permit file names of any length. this will cause it to create archives which are not compatible with the nativearprogram on some systems. if this is a concern, thefmodifier may be used to truncate file names when putting them in the archive. βοΈiβ Insert new files before an existing member of the archive. if you use the modifieri, the name of an existing archive member must be present as the relpos argument, before the archive specification. (same asb). π«Άlβ This modifier is accepted but not used. it's just here. hanging out. πNβ Uses the count parameter. this is used if there are multiple entries in the archive with the same name. extract or delete instance count of the given name from the archive. π’oβ Preserve the original dates of members when extracting them. if you do not specify this modifier, files extracted from the archive are stamped with the time of extraction. β°Pβ Use the full path name when matching names in the archive. GNUarcan not create an archive with a full path name (such archives are not POSIX complaint), but other archive creators can. this option will cause GNUarto match file names using a complete path name, which can be convenient when extracting a single file from an archive created by another tool. π€οΈsβ Write an object-file index into the archive, or update an existing one, even if no other change is made to the archive. you may use this modifier flag either with any operation, or alone. runningar son an archive is equivalent to runningranlibon it. βSβ Do not generate an archive symbol table. this can speed up building a large library in several steps. the resulting archive can not be used with the linker. in order to build a symbol table, you must omit theSmodifier on the last execution ofar, or you must runranlibon the archive. β οΈuβ Normally,ar r... inserts all files listed into the archive. if you would like to insert only those of the files you list that are newer than existing members of the same names, use this modifier. theumodifier is allowed only for the operationr(replace). in particular, the combinationquis not allowed, since checking the timestamps would lose any speed advantage from the operationq. πvβ This modifier requests the verbose version of an operation. many operations display additional information, such as filenames processed, when the modifiervis appended. π£οΈVβ This modifier shows the version number ofar. π
ar ignores an initial option spelt -X32_64, for compatibility with AIX. the behaviour produced by this option is the default for GNU ar. ar does not support any of the other -X options; in particular, it does not support -X32 which is the default for AIX ar. π«
π SEE ALSO π
nm(1), ranlib(1), and the Info entries for binutils.
iykyk. go read those next, bestie ππ
π COPYRIGHT π
Copyright (c) 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.1 or any later version published by the Free Software Foundation; with no Invariant Sections, with no Front-Cover Texts, and with no Back-Cover Texts. a copy of the license is included in the section entitled "GNU Free Documentation License".
and that's the whole page, babes π this was binutils-2.15.97, dated 2005-04-20, and you just read AR(1) front to back. ate. no crumbs. πβ¨π¦
π¦ where this page comes from
- debian bookworm: binutils-h8300-hms 2.16.1-10+b2
- debian trixie: binutils-h8300-hms 2.16.1-13
- ubuntu jammy: binutils-h8300-hms 2.16.1-10build1
- ubuntu noble: binutils-h8300-hms 2.16.1-10build1
- ubuntu resolute: binutils-h8300-hms 2.16.1-15
- ubuntu stonking: binutils-h8300-hms 2.16.1-15
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms