Forrest logo
back to the tar tool

linux:tar:create:gzip

[c]reate a g[z]ipped archive and write it to a [f]ile.
$ tar czf ${path-to-target-tar-gz} ${filename1 filename2 ---}
try on your machine

This command creates a compressed archive file (with the ".tar.gz" extension) that contains one or more specified files. Here is a breakdown of the individual parts of the command:

  • tar: This is the name of the command-line tool used to create and manipulate archive files.
  • c: This specifies that the command should create a new archive.
  • z: This option tells tar to compress the archive using gzip, which results in a smaller file size.
  • f: This specifies the name and path of the archive file that will be created. The "${path-to-target-tar-gz}" is a placeholder that should be replaced with the actual path and filename of the desired archive file.
  • ${filename1 filename2 ---}: These are placeholders for the names of the files to be added to the archive. The actual filenames should be listed in place of these placeholders, separated by spaces. Note that you can include as many filenames as you want, and they will all be included in the same archive.
This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the tar tool