Compress/Uncompress a Linux Directory

I’m so tired of googling this. The reason I have to look it up every-damn-time is because I can never remember exactly what the switches are for compressing/uncompressing.

The following was taken from here.

Create Archive:

[note color=”#DDD”]tar -zcvf example.tar.gz /home/example[/note]

Where:

  • -z: Compress archive using gzip program
  • -c: Create archive
  • -v: Verbose i.e display progress while creating archive
  • -f: Archive File name

Extract Files:

[note color=”#DDD”]tar -zxvf example.tar.gz[/note]

Where:

  • I’m guessing that -x means extract

Extract to a specific directory:

[note color=”#DDD”]tar -zxvf example.tar.gz -C /tmp[/note]
Category(s): Googling for Answers, Linux
Tags: , , ,

Leave a Reply

Your email address will not be published. Required fields are marked *

* Copy this password:

* Type or paste password here: