Tar Command Usage

{lang: 'ar'}

An archive is a single file that has a collection of several other files. On Windows, the ZIP format is a commonly used archive format and on Unix and other Linux Operating System’s, the tar (Tape ARchive) format is commonly used.

 


Creating a tar file

As an example, a listing from a directory is shown below:

[tsc@localhost ~]$ ls
Desktop index.html klipper_configure_actions.png practice wip
GnuPG index.html.1 klipper_configure_gen.png software
images klipper1.png klipper_configure_short.png tmp

Let us create a tar file named klipper.tar that holds all the .png files. The ‘tar’ command is shown below:

[tsc@localhost ~]$ tar -cvf klipper.tar klipper_configure_actions.png klipper_configure_gen.png klipper1.png klipper_configure_short.png

In the above cvf denotes the following:

c : create a new archive

v: verbosely list files processed

f: archive file

You can also use wildcards in the above example as follows:

tar -cvf klipper.png *.png

List files in the Archive

tar -tvf [file] produces a listing of the archived files verbosely.

[tsc@localhost ~]$ tar -tvf klipper.tar

Extract files from Archive

tar -xvf [file] extracts files from the archive verbosely. Output as follows:

[tsc@localhost ~]$ tar -xvf klipper.tar
klipper_configure_actions.png
klipper_configure_gen.png
klipper1.png
klipper_configure_short.png

External Reference

 

Click here for reuse options!

Copyright 2007 referpages

No related posts.

Speak Your Mind

*

Page optimized by WP Minify WordPress Plugin