Linux / Unix – How to open a tar file

A lot of the downloadable Linux or Unix files found on the internet are compressed using a tar or tar.gzcompression format.

So, knowing how to open or untar these compressed files becomes very important. In the following examples, we will explain how to untar both popular formats and how to extract the contents to a different directory.

How to open or Untar a "tar.gz" file in Linux or Unix:

The following tutorial assumes the name of your file is yourfile.tar.gzReplace with your actual filename.

    1. From the [gs terminal], change to the directory where yourfile.tar.gz has been downloaded.
    2. Type tar -zxvf yourfile.tar.gz to extract the file to the current directory.

    You can specify a different directory to extract to using -C parameter and a path to the directory as follows:

    Example: 

    tar -C /myfolder -zxvf yourfile.tar.gz

    How to open or Untar a "tar" file in Linux or Unix:

    1. From the [gs terminal], change to the directory where yourfile.tar has been downloaded.
    2. Type tar -zxvf yourfile.tar to extract the file to the current directory.
    3. Or tar -C /myfolder -zxvf yourfile.tar to extract to another directory.
    SOURCE

    LINK (Pendrivelinux.com)

    LANGUAGE
    ENGLISH