📄 ar.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"><html><head><!-- Copyright 1997 The Open Group, All Rights Reserved --><title>ar</title></head><body bgcolor=white><center><font size=2>The Single UNIX ® Specification, Version 2<br>Copyright © 1997 The Open Group</font></center><hr size=2 noshade><h4><a name = "tag_000_000_039"> </a>NAME</h4><blockquote>ar - create and maintain library archives</blockquote><h4><a name = "tag_000_000_040"> </a>SYNOPSIS</h4><blockquote><pre><code>ar -d<b>[</b>-v<b>][</b>-l<b>]</b><i> archive file</i> ...ar -m<b>[</b>-abilv<b>][</b><i>posname</i><b>]</b><i> archive file</i> ...ar -p<b>[</b>-v<b>][</b>-s<b>]</b><i>archive</i><b> [</b><i>file</i> ...<b>]</b>ar -q<b>[</b>-clv<b>] </b><i>archive file</i> ...ar -r<b>[</b>-cuv<b>][</b>-abil<b>][</b><i>posname</i><b>]</b><i>archive file</i> ...ar -t<b>[</b>-v<b>][</b>-s<b>]</b><i>archive </i><b>[</b><i>file</i> ...<b>]</b>ar -x<b>[</b>-v<b>][</b>-sCT<b>]</b><i>archive </i><b>[</b><i>file</i> ...<b>]</b></code></pre></blockquote><h4><a name = "tag_000_000_041"> </a>DESCRIPTION</h4><blockquote>The<i>ar</i>utilitycan be used to create and maintain groups of filescombined into an archive.Once an archive has been created, new files can be added,and existing files can be extracted, deleted or replaced.When an archive consists entirely of valid object files,the implementation will format the archive so that it is usableas a library for link editing (see<i><a href="c89.html">c89</a></i>,<i><a href="cc.html">cc</a></i>and<i><a href="fort77.html">fort77</a></i>).When some of the archived files are not valid object files,the suitability of the archive for library use is undefined.If an archive fileconsists entirely of printable files,the entire archive file is printable.<p>When<i>ar</i>creates an archive file, it creates administrative informationin a format that is portable across all machines.When there is at least one object file that<i>ar</i>recognises as such in the archive,an archive symbol table is created in the archive fileand maintained by<i>ar</i>;it is used by the link editorto search the archive file.Whenever the<i>ar</i>utility is used to create or update the contents of such an archive, thesymbol table is rebuilt.The<b>-s</b>option forces the symbol table to be rebuilt.<p>All<i>file</i>operands can be pathnames.However, fileswithin archives are named by a filename, which is the last component ofthe pathname used when the file was entered into the archive.The comparison of<i>file</i>operands to the names of files in archives isperformed by comparing the last component of the operand to the name of thearchive file.<p>It is unspecified whether multiple filesin the archive may be identically named.In the case of such files, however, each<i>file</i>and<i>posname</i>operand will matchonly the first archive file having a name that is the same as thelast component of the operand.</blockquote><h4><a name = "tag_000_000_042"> </a>OPTIONS</h4><blockquote>The<i>ar</i>utility supports the <b>XBD</b> specification, <a href="../xbd/utilconv.html#usg"><b>Utility Syntax Guidelines</b> </a> .<p>The following options are supported:<dl compact><dt><b>-a</b><dd>Position new files in the archive after the file named by the<i>posname</i>operand.<dt><b>-b</b><dd>Position new files in the archive before the file named by the<i>posname</i>operand.<dt><b>-c</b><dd>Suppress the diagnostic message that is written to standard errorby default whenthe archive file<i>archive</i>is created.<dt><b>-C</b><dd>Prevent extracted files from replacinglike-named files in the file system.This option is useful when<b>-T</b>is also used, to prevent truncatedfilenames from replacing fileswith the same prefix.<dt><b>-d</b><dd>Delete one or more<i>file</i>sfrom<i>archive.</i><dt><b>-i</b><dd>Position new files in the archive before the file named by the<i>posname</i>operand (equivalent to<b>-b</b>).<dt><b>-l</b><dd>Place temporary files in the local current working directory,rather than in the directory specified by the environment variable<i>TMPDIR</i>or in the default directory. (<b>LEGACY</b>)<dt><b>-m</b><dd>Move the named files.The<b>-a</b>,<b>-b</b>or<b>-i</b>options with the<i>posname</i>operand indicate the position;otherwise, move the files to the end of the archive.<dt><b>-p</b><dd>Write the contents of the<i>file</i>sfrom<i>archive</i>to the standard output.If no<i>file</i>sare specified, the contentsof all files in the archive will be writtenin the order of the archive.<dt><b>-q</b><dd>Quickly append the named files to the end of the archive file.In this case<i>ar</i>does not check whether the added membersare already in the archive.This is useful to bypass the searching otherwise donewhen creating a large archive piece by piece.<dt><b>-r</b><dd>Replace or add<i>file</i>sto<i>archive</i>.If the archive named by<i>archive</i>does not exist, a new archive file will be createdand a diagnostic message will be written to standard error(unless the<b>-c</b>option is specified).If no<i>file</i>sare specified and the<i>archive</i>exists, the results are undefined.Files that replace existing files will not change theorder of the archive.Files that do not replace existing files will be appended to the archive.<dt><b>-s</b><dd>Force the regeneration of the archive symbol table even if<i>ar</i>is not invoked with an option that will modify the archive file contents.This option is useful to restore the archive symbol table afterit has been stripped; see<i><a href="strip.html">strip</a></i>.<dt><b>-t</b><dd>Write a table of contents of<i>archive</i>to the standard output.The files specified by the<i>file</i>operands will be included in the written list.If no<i>file</i>operands are specified, all files in<i>archive</i>will be includedin the order of the archive.<dt><b>-T</b><dd>Allow filename truncation of extracted fileswhose archive names are longer than the file systemcan support.By default, extracting a file with a name thatis too long is an error;a diagnostic message will be written andthe file will not be extracted.<dt><b>-u</b><dd>Update older files.When used with the<b>-r</b>option, files within the archive will be replacedonly if the corresponding<i>file</i>has a modification timethat is at least as new as the modification timeof the file within the archive.<dt><b>-v</b><dd>Give verbose output.When used with the option characters<b>-d</b>,<b>-r</b>or<b>-x</b>,write a detailed file-by-file description of the archive creationand maintenance activity, as described in the STDOUT section.When used with<b>-p</b>,write the name of the file to the standard outputbefore writing the file itself to the standard output,as described in the STDOUT section.When used with<b>-t</b>,include a long listing of information about the fileswithin the archive,as described in the STDOUT section.<dt><b>-x</b><dd>Extract the files named by the<i>file</i>operands from<i>archive</i>.The contents of the archive file will not be changed.If no<i>file</i>operands are given, all files in the archivewill be extracted.If the filename of a file extracted from the archive is longerthan that supported in the directory to which it is being extracted,the results are undefined.The modification time of each file extracted will be set to thetime the file is extracted from the archive.</dl></blockquote><h4><a name = "tag_000_000_043"> </a>OPERANDS</h4><blockquote>The following operands are supported:<dl compact><dt><i>archive</i><dd>A pathname of the archive file.<dt><i>file</i><dd>A pathname.Only the last component will be used whencomparing against the names of files in the archive.If two or more
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -