How to extract .tar.gz files in Linux/UNIX OS

A tarball is a group of files that are bundled together using the tar command.

  1. Use the following command line to uncompress .tar.gz file. For example, name.tar.gz
    $ tar xvzf name.tar.gz

    Where,
    x = Tells tar to extract the files.
    v = Stands for “verbose” will list all of the files one by one in the archive.
    z = Tells the tar command to uncompress the file (gzip).
    f = Tells tar to give it a file name to work with.

  2. To uncompress into a different directory
    $ tar xvzf name.tar.gz -C /path/to/directory

    Where,
    c = change the directory 

  3. To extract specificc file from .tar.gz tarball. For example, myfile.php
    $ tar -xvzf name.tar.gz myfile.php
  4. To view detailed file list
    $ tar -tvf name.tar.gz

 

  • unix, file, extract, archive, tar, linux, centos, debian
  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

How to restrict direct root access in Linux

We can do it just in two steps. Step One: At first we will create new root user as follows (for...

How to add welcome message when SSH start?

You need to change the contents of /etc/motd. Unfortunately, by default, /etc/motd is a link to...

How to change root password when SSH logged in

Run the following command: passwd Now type your new passwordOnce done, retype new passwordDone!...

How to install Pinguzo on any Linux/UNIX OS

Login to Pinguzo panel using Softaculous account or create an account of Pinguzo To add new...

How to use Postfix as Relay for Mailgun SMTP Relay

Mailgun is a popular SMTP Relay/API service, one of my favorites. For transactional emails, I...