compress a folder

Pack a folder into one compressed file, look inside it, and unpack it again.

archivesfiles

steps
  1. tar -czf folder.tar.gz folder/

    pack and compress with gzip, fast

  2. tar -cJf folder.tar.xz folder/

    with xz: smaller, slower

  3. zip -r folder.zip folder/

    a zip, for people on Windows

  4. tar -tzf folder.tar.gz

    list what is inside, without unpacking

  5. tar -xzf folder.tar.gz

    unpack it here

  6. unzip folder.zip

    unpack a zip

notes
  • lore explain "tar -czf folder.tar.gz folder/" says what each letter does.
  • GNU tar also does zstd, fast and small: tar --zstd -cf folder.tar.zst folder/.
commands used

tarzipunzipgzipxz

Each has a page in lore: lore tar opens it.