9951 explained code solutions for 126 technologies

cli-tarHow do I use tar and gzip in Linux?

Tar and gzip are two of the most popular archiving and compression utilities for Linux.

tar -cvzf archive.tar.gz <files>

This command will create an archive file called archive.tar.gz, containing all the files listed in <files>.

  • tar: creates an archive file
  • -c: creates a new archive
  • -v: verbose output
  • -z: compress the archive with gzip
  • -f: specifies the name of the archive

The archive can be extracted with:

tar -xvzf archive.tar.gz

  • -x: extract files from the archive


Edit this code on GitHub