Ubuntu technical problems and solutions reference, a modern cookbook.
Compress and Extract files with tar.gz
June 26, 2012Posted by on
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 *
– 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 *
– x – extract