Latest web development tutorials

Linux ar command

Linux command Daquan Linux command Daquan

Linux ar command is used to create or modify documents kept by or extracted from the file kept in the file.

ar allows you to set many files into a single file is kept. Kept in the file, all the members are to retain the original file attributes and permissions.

grammar

ar[-dmpqrtx][cfosSuvV][a<成员文件>][b<成员文件>][i<成员文件>][备存文件][成员文件]

Parameters:

Necessary parameters:

  • -d delete documents kept by a member of the file.
  • -m Change file members in order to keep the file.
  • -p display of documents kept by the members of the contents of the file.
  • -q family will ask additional documents kept in the end.
  • -r kept the file into the file.
  • -t display kept files contained.
  • -x-owned dump file members removed files.

Option parameter:

  • a <member file> insert the file into standby after keeping of files specified in the file.
  • b <member file> insert a file kept by the members before the file specified.
  • c establish kept files.
  • f To avoid long file name is not compatible with other systems ar command directives, so can use this parameter to put members of the truncated file name in the file kept too long.
  • i <member file> will ask family members inserted before the file specified in the file kept.
  • o date reserved documents kept in the file.
  • s If kept file contains the object model, this parameter can be established to keep the symbol table file.
  • S does not generate a symbol table.
  • u only newer file date is inserted to keep the file.
  • Display detailed information about the implementation of the program v.
  • V Display version information.

Examples

Packed file

[[email protected] ~]# ls   //显示当前目录文件   
a.c	b.c d.c   install.log	  qte
anaconda-ks.cfg c.c Desktop 

[[email protected] ~]# ar rv one.bak a.c b.c //打包 a.c b.c文件 
ar: 正在创建 one.bak
a - a.c
a - b.c
[[email protected] ~]# 

Package multiple files

[[email protected] ~]# ar rv two.bak *.c  //打包以.c结尾的文件  
ar: 正在创建 two.bak
a - a.c
a - b.c
a - c.c
a - d.c
[[email protected] ~]# 

Display the contents of the package file

[[email protected] ~]# ar t two.bak    
a.c
b.c
c.c
d.c
[[email protected] ~]# 

Delete files packaged file members

[[email protected] ~]# ar d two.bak a.c b.c c.c  
[[email protected] ~]# ar t two.bak       
d.c

Linux command Daquan Linux command Daquan