😇

How to remember `tar` command options without Googling

2023/03/06に公開

Motivation

I'm writing this article because I want to stop relying on Google every time I come across a tar.gz file. After realizing that it would be more efficient to categorize and comprehend the available options, I decided to compile a list to make it easier to remember. The tar --help command produces an extensive list of options, and we have taken the liberty of extracting and organizing the most frequently used ones for your convenience.

tar option classification

Main operation mode (what to do)

option keyword description
c create compression case
x extract decompression case

Compression options

option keyword description
z gzip use gzip program like tar.gz
j bzip uses bzip2 program like tar.bz2
J xz uses xz program like tar.xz
a auto tar command determines compression program

Informative output

option keyword description
v verbose verbosely output

Device selection and switching

option keyword description
f file output file practically required

Example

When decompressing tar.gz

classification choice
Main operation mode x
Compression options z
Informative output (v)
Device selection and switching f

You will use xzvf or xzf option.

Discussion