To decompress a .tgz or .tar.gz file and extract its contents on a Unix-like system, you can use the tar command.
Here's the basic syntax:
tar -xzvf file.tar.gz
This will extract the contents of the file.tar.gz archive into the current directory. The options used are:
x: Extract the contents of the archivez: Decompress the archive using gzipv: Display progress in the terminal while extracting the filesf: Specify the name of the archive fileIf you want to extract the files to a specific directory, you can use the -C option followed by the destination directory:
tar -xzvf file.tar.gz -C /path/to/destination/directory
You can also extract .tar archives (uncompressed tar files) using the same command, just omit the z option:
tar -xvf file.tar