Ubuntu Technical

Ubuntu technical problems and solutions reference, a modern cookbook.

Compress and Extract files with tar.gz

Or simply building a “tarball” as it is sometimes called. Even though this is a trivial task, I found myself quite often looking for the command, better yet for the options, because I tend to forget. So why not look for the command on my own blog.

Creating a tar archive

cd location_of_files_to_be_archived
tar cvzf name_of_archive.tar.gz *

Parameters explained:
– c – create
– v – verbose output
– z – –gzip, –gunzip, –ungzip filter the archive through gzip
– f – use the following file for archive

Note: The f option needs to be the last in the list of parameters. Whatever characters are following f, will be the name of the tarball.

Extract a tar archive

cd location_of_files_to_be_archived
tar xvzf name_of_archive.tar.gz *

Parameters explained:
– x – extract

Cheers



Flattr this

Advertisements

2 responses to “Compress and Extract files with tar.gz

  1. Pingback: Compress and Extract files with tar.gz | Nur Ichsan's Site

  2. Pingback: Extract a tar.gz package « Lessons learned

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

%d bloggers like this: