9951 explained code solutions for 126 technologies

cli-tarHow do I use the command line to create a tar.gz file?

To create a tar.gz file using the command line, the following command can be used:

tar -czvf <file_name>.tar.gz <file_name>

The parts of the command are as follows:

  • tar: The command used to create a tar file
  • -czvf: Options used to create a tar file in gzip format with verbose output
  • <file_name>.tar.gz: The name of the output tar file
  • <file_name>: The name of the file to be compressed

The output of the command will be the newly created tar.gz file.

For more information, see the GNU Tar Manual.

Edit this code on GitHub