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 Back Up Your SuiteCRM Project

Making regular backups of your SuiteCRM project is crucial. Backups help keep any kind of data safe, and also provide a quick recovery after a crash, hacking attack, or any user error. Because of how important backups are for your SuiteCRM website, in this article, we...

How to Install Themes in Zenphoto

Zenphoto allows you to customize the look of your online gallery by incorporating various themes. If you are interested in learning how to install themes in Zenphoto, then this article will guide you through the entire process - from browsing and downloading, through...

How to Add Tags in Zenphoto

Tags are a handy feature for organizing your Zenphoto images and albums. Tags not only help you and your visitors navigate more easily and quickly through your website, but also improve its discoverability in search engines, and can also help you generate more organic...

How to Upload Files in Zenphoto

Knowing how to upload files in Zenphoto is a fundamental skill. In this guide, we share how to go through the process and manage your project and media library quickly and easily.   Step 1: Log in to Zenphoto The first step in the process is to log in to...

How to Back Up your TYPO3 Project

In this article, we outline the step-by-step process for backing up your TYPO3 project, ensuring that all your data, settings, and other essential information are safely stored. Regardless of your level of expertise, this method is simple to follow and provides...



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 Back Up Your SuiteCRM Project

Making regular backups of your SuiteCRM project is crucial. Backups help keep any kind of data safe, and also provide a quick recovery after a crash, hacking attack, or any user error. Because of how important backups are for your SuiteCRM website, in this article, we...

How to Install Themes in Zenphoto

Zenphoto allows you to customize the look of your online gallery by incorporating various themes. If you are interested in learning how to install themes in Zenphoto, then this article will guide you through the entire process - from browsing and downloading, through...

How to Add Tags in Zenphoto

Tags are a handy feature for organizing your Zenphoto images and albums. Tags not only help you and your visitors navigate more easily and quickly through your website, but also improve its discoverability in search engines, and can also help you generate more organic...

How to Upload Files in Zenphoto

Knowing how to upload files in Zenphoto is a fundamental skill. In this guide, we share how to go through the process and manage your project and media library quickly and easily.   Step 1: Log in to Zenphoto The first step in the process is to log in to...

How to Back Up your TYPO3 Project

In this article, we outline the step-by-step process for backing up your TYPO3 project, ensuring that all your data, settings, and other essential information are safely stored. Regardless of your level of expertise, this method is simple to follow and provides...

How to Install Themes in TYPO3

Learning how to install themes in TYPO3 is essential, as it enables you to personalize your website fully. Whether you are working on a personal blog or a complex business website, the process of installing a theme in TYPO3 is the same. In this article, we share how...

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.