How to use tar command in Linux

tar command is very useful for file compression.  The format of the command is like this:
tar cvzf [archive_name].tar.gz [what_to_compress]

For example:
You have the files abc.txt and def.txt and you want to compress them into an archive called
archive.tar.gz

The command is:
tar cvzf archive.tar.gz abc.txt def.txt

To extract the files from the archive, you need to use:
tar xvf archive.tar.gz

note: you can omit the v in cvzf and xvf, since v just shows you the files being compressed or extracted from a compressed archive.

Advertisements
This entry was posted in Linux Tips. Bookmark the permalink.

One Response to How to use tar command in Linux

  1. Pingback: How to compress files while using linux terminal with tar via ssh ? | beginnershostingguide

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s