首页

ar

ar
功能说明:建立或修改备存文件,或是从备存文件中抽取文件。
语  法:ar[-dmpqrtx][cfosSuvV][a<成员文件>][b<成员文件>][i<成员文件>][备存文件][成员文件]
补充说明:ar可让您集合许多文件,成为单一的备存文件。在备存文件中,所有成员文件皆保有原来的属性与权限。
参  数:
 指令参数 
 -d  删除备存文件中的成员文件。 
 -m  变更成员文件在备存文件中的次序。 
 -p  显示备存文件中的成员文件内容。 
 -q  将问家附加在备存文件末端。 
 -r  将文件插入备存文件中。 
 -t  显示备存文件中所包含的文件。 
 -x  自备存文件中取出成员文件。 
 选项参数 
 a<成员文件>  将文件插入备存文件中指定的成员文件之后。 
 b<成员文件>  将文件插入备存文件中指定的成员文件之前。 
 c  建立备存文件。 
 f  为避免过长的文件名不兼容于其他系统的ar指令指令,因此可利用此参数,截掉要放入备存文件中过长的成员文件名称。 
 i<成员文件>  将问家插入备存文件中指定的成员文件之前。 
 o  保留备存文件中文件的日期。 
 s  若备存文件中包含了对象模式,可利用此参数建立备存文件的符号表。 
 S  不产生符号表。 
 u  只将日期较新文件插入备存文件中。 
 v  程序执行时显示详细的信息。 
 V  显示版本信息。

ar

ar key [args] [posname] [count] archive [files]

Maintain a group of files that are combined into a file archive. Used most commonly to create and update static library files, as used by the link editor (ld). Compiler frontends often call ar automatically. Only one key letter may be used, but each can be combined with additional args (with no separations between). posname is the name of a file in archive. When moving or replacing files, you can specify that they be placed before or after posname. ar has largely been superseded by tar and bzip2.

Keys

d

Delete files from archive.

m

Move files to end of archive.

p

Print files in archive.

q

Append files to archive.

r

Replace files in archive.

t

List the contents of archive or list the named files.

x

Extract contents from archive or only the named files.

Arguments

a

Use with r or m key to place files in the archive after posname.

b

Same as a, but before posname.

c

Create archive silently.

f

Truncate long filenames.

i

Same as b.

l

For backward compatibility; meaningless in Linux.

N

Use count parameter. Where multiple entries with the same name are found, use the count instance.

o

Preserve original timestamps.

P

Use full pathname. Useful for non-POSIX-compliant archives.

s

Force regeneration of archive symbol table (useful after running strip).

S

Do not regenerate symbol table.

u

Use with r to replace only files that have changed since being put in archive.

v

Verbose; print a description of actions taken.

V

Print version number.

Example

Replace mylib.a with object files from the current directory:

ar r mylib.a `ls *.o`