tar — archiving and extracting files
cheat sheet · GNU tar https://lab.dimsanych.ru/en/wiki/tar/Cheat sheet
-
tar czf a.tar.gz dircreate (gzip) -
tar czf a.tar.gz -C /base subwithout extra top-level directories -
tar xzf a.tar.gz -C /destextract into a directory -
tar xzf a.tar.gz --strip-components=1 -
tar tvzf a.tar.gzview the contents - c=create x=extract t=list z=gzip J=xz v=verbose f=file -C directory
Options
f requires an argument — the archive name — and by convention goes last
in a group of letters (czf, not fcz). Before extracting an unfamiliar
archive for the first time, look at its contents with tar tzf: if the
listing has no common top-level directory, extraction will scatter files
straight into the current directory.