Tar Cheatsheet

Tar archive creation, extraction, and compression with gzip and bzip2

File Compression6 commandsbeginner

Overview

Tar creates and manages tape archive files for bundling multiple files.

Why It Matters

Tar is the standard tool for creating and extracting archives on Unix/Linux systems.

Essential Commands

tar -cvf archive.tar folder/

Create uncompressed tar archive

tar -xvf archive.tar

Extract tar archive contents

tar -czvf archive.tar.gz folder/

Create gzip-compressed archive

tar -xzvf archive.tar.gz

Extract gzip-compressed archive

tar -tvf archive.tar

List archive contents without extracting

tar -xvf archive.tar file.txt

Extract specific file from archive

Quick Start

Start with the create archives with tar -cf

Key Concepts

Create archives with tar -cf

Extract archives with tar -xf

Combine with gzip/bzip2 for compression

Pro Tips

  • Combine multiple commands for powerful workflows
  • Use aliases to speed up your command entry
  • Create scripts to automate repetitive tasks

Common Pitfalls to Avoid

  • Forgetting to check the documentation for edge cases
  • Running commands without understanding their full impact
  • Not testing changes in a safe environment first

Related Resources

6 items

Quick Reference

Use Tools