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 Install Moodle

You can install Moodle on all AwardSpace web hosting plans. This includes our free web hosting, shared hosting, and the advanced AwardSpace services such as Semi-Dedicated Hosting and VPS hosting. You can also install Moodle in minutes, whichever you choose. Keep in...

How to Check If SELinux Is Enabled in MediaWiki

Although installing MediaWiki and logging in to the platform is a simple task, setting up the CMS can be challenging at times, especially when the process involves server configurations. A critical aspect of web server security is the so-called Security-Enhanced Linux...

How to View and Manage Recent Images in MediaWiki

MediaWiki offers numerous versatile tools that help you manage and display recent images on your wiki pages. This guide showcases how to view and manage recent images in MediaWiki, so you can make it easier for logged-in users and admins to organise image content on...

How to Enable and Customize User Glow in MediaWiki

Now that you have installed MediaWiki and logged in to the admin panel, and you also learned how to add modules, it is time to make your wiki a bit more engaging and user-friendly. There are numerous ways to customize your Wiki project and one handy approach is to add...

How to Find Modules in MediaWiki

After you install MediaWiki, log in to the CMS, and presumably install extensions, it is time to learn how to find modules in MediaWiki.   What are MediaWiki Modules Modules in MediaWiki are Lua-based scripts that allow you to add various functionalities to your...



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 Install Moodle

You can install Moodle on all AwardSpace web hosting plans. This includes our free web hosting, shared hosting, and the advanced AwardSpace services such as Semi-Dedicated Hosting and VPS hosting. You can also install Moodle in minutes, whichever you choose. Keep in...

How to Check If SELinux Is Enabled in MediaWiki

Although installing MediaWiki and logging in to the platform is a simple task, setting up the CMS can be challenging at times, especially when the process involves server configurations. A critical aspect of web server security is the so-called Security-Enhanced Linux...

How to View and Manage Recent Images in MediaWiki

MediaWiki offers numerous versatile tools that help you manage and display recent images on your wiki pages. This guide showcases how to view and manage recent images in MediaWiki, so you can make it easier for logged-in users and admins to organise image content on...

How to Enable and Customize User Glow in MediaWiki

Now that you have installed MediaWiki and logged in to the admin panel, and you also learned how to add modules, it is time to make your wiki a bit more engaging and user-friendly. There are numerous ways to customize your Wiki project and one handy approach is to add...

How to Find Modules in MediaWiki

After you install MediaWiki, log in to the CMS, and presumably install extensions, it is time to learn how to find modules in MediaWiki.   What are MediaWiki Modules Modules in MediaWiki are Lua-based scripts that allow you to add various functionalities to your...

How to Fix MediaWiki Internal Error: A Step-By-Step Guide

MediaWiki Internal Error message can be very frustrating and can significantly harm your MediaWiki project. Luckily, the issue can be fixed in a few easy-to-follow steps to get your website up and running in no time. There are various causes for the issue: Incorrect...

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.