9951 explained code solutions for 126 technologies


cli-tarHow do I unzip a tar.gz file in Unix?


To unzip a tar.gz file in Unix, use the following command:

tar -xzf <file_name>.tar.gz

This command will extract the contents of the tar.gz file into the current directory.

The command parts are:

  • tar: The tar command is used to create, modify, and extract tar archives.
  • -xzf: This option tells tar to extract the contents of the tar.gz file.
    • -x: Extract files from an archive.
    • -z: Filter the archive through gzip.
    • -f: Use the following tar archive for the operation.
  • <file_name>.tar.gz: The name of the tar.gz file to be extracted.

For more information, please refer to the following links:

Edit this code on GitHub