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.

It's Time to Share Your Story.

Get Free Web Hosting. Start a website, and introduce yourself to the world.

Get Free Hosting
Related Posts

How Can I Get an SSL Certificate?

Nowadays, it is almost impossible to run a successful website without securing it with SSL. When you buy an SSL certificate, you will gain several benefits, chief among them being the ability to enable HTTPS. You will also be increasing […]

Do I Need a Separate SSL Certificate for the “www” and “non-www” Versions of My Website?

If you have ever ventured into the SSL Manager section of the Control Panel, you may have noticed that all of your domain names are listed twice – once with the “www” prefix and once without it. As such, it […]

What Is the Purpose of the Intermediate Certificate Authority in SSLs?

SSL certificates are, without a doubt, becoming more and more ubiquitous throughout the web. Not only do they allow you to secure visitors’ connections to your site, but they can also help you rank better in search results. As such, […]

awardspace logo
Where Ideas Turn Into Websites