Linux Tar and Archives

Pack, compress, and extract tarballs without surprises.

  • linux tar
  • extract tarball
  • gzip
  • zip unzip
  • strip-components

Linux Tar and Archives

Pack, compress, and extract tarballs without surprises.

Commands

CommandWhat it does
tar -czf archive dirCreate gzipped archive
tar -tzf archive, list firstList contents safely first
tar -xzf to dirExtract to a directory
strip top-level folderDrop the wrapper folder on extract
zip create and listZip interchange commands

Example

tar -czf backup.tar.gz app/
tar -tzf backup.tar.gz | head

FAQ

When is strip-components useful?

Release tarballs wrap code in a version folder; stripping extracts contents directly.

tar.gz vs zip?

tar.gz preserves unix permissions and streams well; zip suits Windows interchange.

Câu hỏi thường gặp

When is strip-components useful?
Release tarballs wrap code in a version folder; stripping extracts contents directly.
tar.gz vs zip?
tar.gz preserves unix permissions and streams well; zip suits Windows interchange.

Linux