How to Unzip file .tar.gz on hosting?

Mujkanovic

Well-known member
Joined
Apr 24, 2016
Messages
365
Points
18
After backup my website on cpanel, i got this file type, filename.tar.gz . How to unzip this file in SSH? I can not use Unzip command in ssh to unzip .gz file.
 

Kaz Wolfe

Well-known member
Joined
Jul 7, 2016
Messages
520
Points
28
To extract a tar.gz file, you need to use this command with extra parameters --extract (-x) option and specify the archive file name after the f option:

Code:
tar -xf filename.tar.gz
 

fiz

Well-known member
Joined
Aug 6, 2020
Messages
109
Points
16
After backup my website on cpanel, i got this file type, filename.tar.gz . How to unzip this file in SSH? I can not use Unzip command in ssh to unzip .gz file.
You are supposed to use this file to restore your backup through WHM. If you are on shared hosting then you can ask your provider to restore it for you. If you want to extract something manually then you can run the following command to extract files from the archive.

Bash:
tar -zxvf file_name.tar.gz
In case you want to extract it to a specific directory use the following:
Code:
tar -C /home/backups/ -zxvf file_name.tar.gz
You can replace /home/backups/ with your desired path.
 

Mujkanovic

Well-known member
Joined
Apr 24, 2016
Messages
365
Points
18
Why commands have -xf and-zxvf, which case should I use one of them?
I tried to unzip a .tar.gz file and it only consumed some seconds to unzip 3 GB data, it is more faster than unzip command :LOL:
 

createcraig

New member
Joined
Nov 24, 2020
Messages
4
Points
1
@Mujkanovic, these are flags in tar. You can type man tar in Linux shell to see the commands.

The -x flag for the tar command means extract
The -z command means to gzip. Normal .tar files you don't need this, but with .tar.gz you need to use gzip to unzip.
The -v command means to do it verbosely, so it shows you what is being unzipped.
The -f command means force, so do not ask you "Are you sure you want to do this?"
 

Sathya narayana

New member
Joined
Nov 25, 2020
Messages
3
Points
1
Hi there,
We will cover the compression and extraction method of popular archive formats, including .tar.gz, .tar, .zip, and .rar.

.tar.gz Files
  1. You can use the command below to compress several files into a .tar.gz archive:tar -czvf archive-name.tar.gz your-file.text your-file.php your-file.html
    If you intend to compress an entire directory, use the following method.
    Don’t forget to replace “archive-name” and “your-file” with your actual file names and directories. Also, you are not limited to file formats that are used in this example.
    tar -czvf archive-name.tar.gz /Directory-Name
  2. To extract a .tar.gz archive, enter:tar -zxvf archive-name.tar.gz
.tar Files
  1. The syntax for creating .tar archives is as follows:tar -zcf archive-name.tar your-file.php your-file.php your-file.html
    Enter the following line to move the whole directory to a .tar file:
    tar -zcf archive-name.tar.gz /directory-name
  2. You can extract the previous archive by typing this command:tar -xvf archive-name.tar
.zip Files
  1. For .zip files, we’ll be using the zip command instead of tar. Here’s how you create an archive in this format:zip archive-name.zip your-file.php your-file.php your-file.php
    In order to compress a directory, use this syntax:
    zip -r archive-name.zip /directory-name
  2. This command is used for .zip file decompression:unzip archive-name.zip
.rar Files
  1. The command for RAR compression is rar, as shown below:rar a archive-name.rar your-file.txt your-file.php your-file.html
    To put an entire folder into one .rar archive, you should use this syntax.
    rar a archive-name.rar /directory-name
  2. This is how you extract the .rar archive.unrar x archive-name.rar
 
Newer Threads
Replies
6
Views
154
Replies
1
Views
111
fiz
Replies
7
Views
184
Latest Threads
Replies
2
Views
41
Replies
0
Views
57
Replies
7
Views
184
Replies
1
Views
111
fiz
Similar Threads

Latest postsNew threads

Latest Hosting OffersNew Reviews

Sponsors

Latest Blog ArticlesMost Viewed Threads

Tag Cloud

You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an alternative browser.

Top