Where to start First steps track · 15 stages
Linux Labs

tar — archiving and extracting files

cheat sheet · GNU tar https://lab.dimsanych.ru/en/wiki/tar/

Cheat sheet

  • tar czf a.tar.gz dir create (gzip)
  • tar czf a.tar.gz -C /base sub without extra top-level directories
  • tar xzf a.tar.gz -C /dest extract into a directory
  • tar xzf a.tar.gz --strip-components=1
  • tar tvzf a.tar.gz view 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.

Loading…