am a new Linux user. I am having problem with the Terminal. How do I unpack .tgz (tar.gz) file on a Linux using command line option?
Most Linux and open source software files are distributed in either .tgz or .tar.gz extensions format over the Internet. These files are gzipd tar balls and include multiple files and sub-directories into a single file using tar command. To save the bandwidth tar files are cpmpressed using gzip program.
Unpacking .tgz files command
The syntax is as follows:
tar zxvf fileNameHere.tgz
Or try the geeky bash pipe based syntax:
gunzip -c fileNameHere.tgz | tar xvf –
In this example, unpack a file called backups.tgz, enter:
tar zxvf backups.tgz
gunzip -c backups.tgz | tar xvf –
tar: Removing leading / from member names
To unpack and put files in a different folder (directory) say /tmp/data, enter:
tar zxvf backups.tgz -C /tmp/data
ls -l /tmp/data
TAR COMMAND OPTIONS
-z : Uncompress the resulting archive with gzip command.
-x : Extract to disk from the archive.
-v : Produce verbose output i.e. show progress and file names while extracting files.
-f backup.tgz : Read the archive from the specified file called backup.tgz.
-C /tmp/data : Unpack/extract files in /tmp/data instead of the default current directory.
See tar(1) for more information.