To compress a file or folder into a tar.gz archive in Ubuntu, you can use the following command in the terminal:
tar -czvf archive-name.tar.gz file-or-folder-name
For example, to compress a folder named “my-folder” into a tar.gz archive named “my-folder.tar.gz”, you can use the following command:
tar -czvf my-folder.tar.gz my-folder
To extract the contents of a tar.gz archive in Ubuntu, you can use the following command in the terminal:
tar -xzvf archive-name.tar.gz
For example, to extract the contents of a tar.gz archive named “my-folder.tar.gz” into a folder named “my-folder”, you can use the following command:
tar -xzvf my-folder.tar.gz -C my-folder
Note that the “-C” option is used to specify the output directory for the extracted files.