A
cd ..
System

Tar Archiving Masters

Essential tar commands for compressing and extracting files without looking up the man page.

2025-08-20
linux, cli, compression

Compress a directory

Create a .tar.gz archive from a directory.

tar -czvf archive_name.tar.gz /path/to/directory
  • -c: Create archive
  • -z: Compress with gzip
  • -v: Verbose output
  • -f: Filename of the archive

Extract an archive

Extract to the current directory.

tar -xzvf archive_name.tar.gz
  • -x: Extract archive

List contents

See what's inside without extracting.

tar -tzvf archive_name.tar.gz

Extract to specific folder

tar -xzvf archive_name.tar.gz -C /target/directory

Was this useful?

Share with your team

Browse More