Online Linux Terminal Logo
OnlineLinuxTerminal
← All Tutorials•Intermediate

Archiving & Compression with Tar & Gzip

Learn how systems administrators create backups, compress logs into tarballs, and unpack software releases using `tar` and `gzip`.

Linux Community2.4k Online

Chat with real Linux users, learn new commands & get free cheat sheet PDFs.

Lesson Objectives

3 Steps
1Step 1: Create a Compressed Tarball Archive

Run `tar -czvf projects_backup.tar.gz /home/user/projects` to bundle the projects folder.

2Step 2: Inspect Archive Contents without Extracting

Run `tar -tvf projects_backup.tar.gz` to verify the list of packaged files.

3Step 3: Decompress Archive into Target Folder

Run `tar -xzvf projects_backup.tar.gz` to extract the archived files.

💡 Pro Tip:

Remember the mnemonic for creating archives: `-czvf` (Create, Gzip, Verbose, File), and extracting: `-xzvf` (eXtract, Gzip, Verbose, File).

bash — terminal