How to extract archive files?

Home » Knowledge Base » Website Management – Advanced » Secure Shell (SSH) » How to extract archive files?

Extracting archive files can be accomplished in many ways, below you can find a few of them.

File Manager
In the Control Panel -> Hosting Tools -> Website Manager -> “File Manager” there is an “Extract” button that automatically detects the file type of the archive and extracts the file in the directory, where it is located.

SSH
Before you connect with SSH, you need to create an SSH account. You can use the How to create an SSH account guide.
The SSH method requires you to first successfully connect through SSH (You can use the How to connect through SSH? guide) and then you can execute the following commands depending on the type of your archive file:

To extract a zipped file use this command:
unzip YOUR_ARCHIVE.zip

To extract a .rar file use this command:
unrar -x YOUR_ARCHIVE.rar

To extract an uncompressed tarball use this command:
tar -xvf YOUR_ARCHIVE.tar

To extract gzipped tarball use this command:
tar -xvfz YOUR_ARCHIVE.tar.gz

To extract bzipped tarball use this command:
tar -xvfj YOUR_ARCHIVE.tar.bz2

Make sure you replace YOUR_ARCHIVE with the name of your archive file.

PHP
Another solution for extracting different archives is through a PHP script. To do this, first, you need to create a PHP file inside the directory where the archive file is currently stored in your account and then you need to add the appropriate code inside the PHP file, depending on the archive type.

To extract a zip file, you need to create a PHP file with the following content:
<?php
$zip = new ZipArchive;
$zip->open('YOUR_ARCHIVE.zip');
$zip->extractTo('./');
$zip->close();
echo "OK!";
?>

To extract a tar file, you need to create a PHP file with the following content:
<?php
try {
$phar = new PharData('YOUR_ARCHIVE.tar');
$phar->extractTo('./');
echo ('File extracted');
} catch (Exception $e) {
}
echo ('OK!')
?>

Make sure you replace YOUR_ARCHIVE with the name of your archive file.

Was this post helpful?

i

Relevant tags:

Connect

Latest posts:

How to Add Products to Zen Cart: A Step-By-Step Guide

After you install Zen Cart and log in to the admin panel, you can start adding products to your online store. This guide walks you through the process step by step.   How to Add Products to Zen Cart To add a product to Zen Cart, you need to follow a few simple...

How to Log in to Zen Cart

Once you install Zen Cart, you can log in to the CMS and start working on your project. The login process is simple and is comprised of only a few steps.   How to Log in to Zen Cart There are two ways to log in to Zen Cart: Method 1: Login by following the...

How to Install Zen Cart

You can install Zen Cart with any of the AwardSpace hosting plans—free web hosting, shared hosting, and advanced plans such as Semi-Dedicated Hosting and VPS hosting. Each AwardSpace hosting service is tailored to run Zen Cart flawlessly and smoothly, regardless of...

How to Log in to phpBB

Now that you have installed phpBB, it is time to learn how to log in to the system and start working with it. The process is simple and is comprised of only a few steps.   How to Log in to phpBB There are several ways you can use to log in phpBB. The process...

How to Install phpBB

You can install phpBB on any AwardSpace hosting plan - on the free web hosting, shared hosting, and also on the advanced AwardSpace plans such as Semi-Dedicated Hosting and VPS hosting. Each AwardSpace hosting service is tailored to run phpBB flawlessly and smoothly,...



Create a website for free!


Free forever

Our Support Team is Here to Help

 

If you need any questions answered, don't hesitate and contact us. Click the button below and follow the instructions. You can expect an answer within an hour.

 

Contact AwardSpace

 

iNewest knowledge base articles

How to Add Products to Zen Cart: A Step-By-Step Guide

After you install Zen Cart and log in to the admin panel, you can start adding products to your online store. This guide walks you through the process step by step.   How to Add Products to Zen Cart To add a product to Zen Cart, you need to follow a few simple...

How to Log in to Zen Cart

Once you install Zen Cart, you can log in to the CMS and start working on your project. The login process is simple and is comprised of only a few steps.   How to Log in to Zen Cart There are two ways to log in to Zen Cart: Method 1: Login by following the...

How to Install Zen Cart

You can install Zen Cart with any of the AwardSpace hosting plans—free web hosting, shared hosting, and advanced plans such as Semi-Dedicated Hosting and VPS hosting. Each AwardSpace hosting service is tailored to run Zen Cart flawlessly and smoothly, regardless of...

How to Log in to phpBB

Now that you have installed phpBB, it is time to learn how to log in to the system and start working with it. The process is simple and is comprised of only a few steps.   How to Log in to phpBB There are several ways you can use to log in phpBB. The process...

How to Install phpBB

You can install phpBB on any AwardSpace hosting plan - on the free web hosting, shared hosting, and also on the advanced AwardSpace plans such as Semi-Dedicated Hosting and VPS hosting. Each AwardSpace hosting service is tailored to run phpBB flawlessly and smoothly,...

How to Remove a Product in OpenCart

After installing OpenCart and logging in to the dashboard, you can start adding and removing products immediately. We have already covered how to add products in OpenCart, and in this article, we share simple steps to delete products from your store with only a few...

Even more web tutorials

Check out our web hosting knowledge base and the WordPress tutorials to learn more, and be better prepared for your website creation and maintenance journey.