Easy Tutorial
❮ Linux Comm Smbclient Linux Comm Lsmod ❯

Linux ar Command

Linux Command Manual

The Linux ar command is used to create, modify, or extract files from an archive.

ar allows you to combine multiple files into a single archive. All member files retain their original attributes and permissions within the archive.

Syntax

ar [-dmpqrtx] [cfosSuvV] [a<member_file>] [b<member_file>] [i<member_file>] [archive_file] [member_file]

Parameters:

Required Parameters:

Optional Parameters:

Examples

Packaging files

[[email protected] ~]# ls   // Display current directory files   
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 // Package a.c b.c files 
ar: Creating one.bak
a - a.c
a - b.c
[[email protected] ~]#

Packaging multiple files

[[email protected] ~]# ar rv two.bak *.c  // Package files ending with .c  
ar: Creating two.bak
a - a.c
a - b.c
a - c.c
a - d.c
[[email protected] ~]#

Displaying the contents of a packaged file

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

Deleting member files from a packaged file

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

Linux Command Manual

❮ Linux Comm Smbclient Linux Comm Lsmod ❯