Extract tar.gz File in Categories BASH Shell, Linux, UNIX
  easystem   28 Januari 2018   Tutorial


The syntax is as follows:

tar options file.tar.gz
tar options file.tar.gz pattern
tar -xf file.tar.gz
tar -xvf file.tar.gz
tar -zxvf file.tar.gz
tar -zxvf file.tar.gz file1 file2 dir1 dir2

Extract tr.gz. file

To extract one or more members from an archive, enter:
$ tar -zxvf {file.tar.gz}
If your tarball name is backup.tar.gz, enter the following at a shell prompt to extract files:
$ tar -zxvf backup.tar.gz
To extract resume.doc file from backup.tar.gz tarball, enter:
$ tar -zxvf backup.tar.gz resume.doc

  1. -z : Work on gzip compression automatically when reading archives.
  2. -x : Extract archives.
  3. -v : Produce verbose output i.e. display progress and extracted file list on screen.
  4. -f : Read the archive from the archive to the specified file. In this example, read backups.tar.gz archive.
  5. -t : List the files in the archive.

Extracting an entire archive

To extract an entire archive, specify the archive file name only, with no individual file names as arguments.
tar -zxvf backup.tar.gz

List files in archive

To view a detailed table of contents (list of file), enter::
$ tar -tvf backup.tar.gz



Tags :

targz , ubuntu

Bagikan :