Команда ar

Поддержание портативных архивов или библиотек.

Синтаксис

ar [-d] [-m] [-p] [-q] [-t] [-x] [-r] [-a] [-b] [-c] [-C] [-F format] [-i] [-l] [-s] [-T] [-I] [-u] [-V] [-v] [ posname ] archive file

-dDeletes each named member from the archive and regenerates the symbol table.
-mMoves the named archive member in the archive. You indicate the new position for the member with -a, -b, or -i and posname; if you do not specify a location, ar moves the member to the end of the archive.
-pDisplays each specified member on the standard output. If you do not specify any members, ar displays all members.
-qQuickly appends the specified file to the archive. ar does not check to see if file is already a member of the archive.
-tDisplays a table of contents that lists member or every member if you do not specify a particular member. ar displays a diagnostic for each member that it cannot find. Normally, ar displays only the member's name, but with the verbose (-v) option, ar displays more information about archive members using a format similar to ls -l.
-xExtracts each specified member from the archive and copies it to a file. If you specify member as a full path name, ar copies it to that path name. If you do not specify a member, ar extracts all members. The archive remains unchanged.
-rReplaces or adds file to archive. If archive does not exist, ar creates it and prints a message. When ar replaces an existing member, it does not change the archive order. If file is not replacing a member, ar adds it to the end of the archive (unless you specify -a, -b, or -i). This option regenerates the symbol table.
-aPlaces file in archive after the member specified by posname. If you do not specify a member, ar adds file to the end of the archive.
-bPlaces file in archive before the member specified by posname. If you do not specify posname, ar adds file to the beginning of the archive.
-cSuppresses the message ar normally prints when it creates a new archive file. You can only use this in conjunction with the -r and -q options.
-CPrevents ar from overwriting existing files with extracted files. You can only specify this option when extracting files with the -x option.
-F formatSpecifies the archive format to be used by a new archive. Valid formats are omf and coff. You can only use this option when creating a new archive with the -r option or the -q option.
-iInserts the file into the archive before the member specified by posname. If you do not specify posname, ar inserts file at the beginning of the archive. This option is the same as -b.
-IIgnores the case of letters when searching the archive for specified member names. Normally, the case is significant.
-lPuts any temporary files that ar generates in the current directory rather than the default temporary file directory.
-sRegenerates the symbol table regardless of whether the command modifies the archive.
-TWhen used with -x, allows extraction of members with names longer than the file system supports; normally, this is an error, and ar does not extract the file. Most file systems truncate the file name to the appropriate length.
-uReplaces the member only if the modification time of the file member is more recent than the time of the archive member. -u implies -r, so it is not necessary to specify -r also.
-VPrints its version number on standard error.
-vGives verbose output. With -d, -q, -r, and -x, this option displays the command letter and the member name affected before performing each operation. With -t, it prints more information about archive members using a format similar to ls -l.  With -p, it displays the member name before the contents.
posnameThe name of a file in the archive file, used for relative positioning; see options -m and -r.
archiveA path name of the archive file.
fileA path name. Only the last component will be used when comparing against the names of files in the archive. If two or more file operands have the same last path name component (basename), the results are unspecified. The implementation's archive format will not truncate valid file names of files added to or replaced in the archive.

Примеры

ar r myfile.a 'ls *.o' - Replace myfile.a with object files in the current directory.

Обратно к списку команд