Wednesday, August 1, 2012

ar and tar command in unix

Working With ar command : Used for the create, modify, and extract from archives.

It is used ot combine objects to create an archive file with .a extension also known as library.

Example

Suppose you have 3 object file (hexa,limit,struct)

ar -cr lib.a hexa limit struct (It will create the lib.a archive )

ar -t lib.a (it will display the list of file in the lib.a archive)

ar -d lib.a hexa (It will delete the hexa object file from the lib.a archive)


ar -x lib.a hexa (It will extract a particular file from the archive ).

ar -r lib.a hexa (It will reinsert the file in the archive ).



-------------------------------------------

Tar commands used to store and extracts files form a tape or disk archive.

Example (suppose we have file hexa.c,limit.c,struct.c, header.c)

tar -cvf demo_AnyName.tar hexa.c limit.c struct .c header.c (It will create a tar ball which contain the above files.)

tar -xvf demo.tar (It Will extract the file from the demo.tar into the current directory)

tar -tvf demo.tar (It will list the file present in the demo.tar)

tar --delete -f demo.tar header.h (It will delete the header.h file from the demo.tar )

   
tar -rvf demo.tar header (It will append or add the file to the demo.tar if it is not present.)

Qualcomm Short Term

  113 is the SL. 1st Target by mid July.

Total Pageviews