'This guide shows how to compress and extract files using tar and tar.gz in Linux.', 'howto' => [ 'Use tar to create archive files.', 'Extract tar files.', 'Use gzip with tar to compress smaller files.', 'Extract tar.gz files.' ], 'why' => 'tar and gzip are standard tools used in Linux for packaging and compressing files efficiently.', 'faq' => [ [ 'q' => 'What is tar?', 'a' => 'tar is a tool used to archive multiple files into a single file.' ], [ 'q' => 'What is tar.gz?', 'a' => 'It is a tar archive compressed with gzip.' ], [ 'q' => 'What does -z mean?', 'a' => 'It enables gzip compression.' ], [ 'q' => 'Can I extract specific files?', 'a' => 'Yes, tar supports extracting specific files using additional options.' ] ] ]; include_once $_SERVER['DOCUMENT_ROOT'] . '/inc/guides/related-guides-helper.php'; include_once $_SERVER['DOCUMENT_ROOT'] . '/inc/guides/related-tools-helper.php'; $relatedGuides = getAutoRelatedGuides($guideSlug, $guideCategory, 5); $relatedTools = getRelatedToolsForGuide($guideSlug, 5); include_once $_SERVER['DOCUMENT_ROOT'] . "/inc/header.html"; ?>

Guides

Essential Linux commands for file compression and extraction.
Linux Guides

Compress and Extract tar and tar.gz

Simple commands to archive and extract files in Linux.

1. Create tar archive

tar -cvf file.tar dir

2. Extract tar archive

tar -xvf file.tar

3. Create tar.gz archive

tar -zcvf file.tar.gz dir

4. Extract tar.gz archive

tar -zxvf file.tar.gz