How to Extract Archives With SSH

Unpacking archives using SSH

Updated over a week ago

Using File Manager, it's possible to extract compressed files. If you would like to do this with SSH, here's what you need to do:

Step 1 - Preparation

Make sure, that your archive is located in the folder, where you expect it to be. If it needs to be uploaded, you can do so with the File Manager or using FTP.

Step 2 - Connection

Enable SSH access and connect to your account using SSH. Open the directory, where your archive is located. For that:

  1. Run ls command. If you see the needed archive, then you can go to Step 3

  2. If the needed file is in a subdirectory, reach it by running:

cd path/to/files

where "path/to/files" is changed by an actual path to your file. For example, if your archive is located in public_html/new/version1, then the command should be "cd new/version1".

Step 3 - Extraction

Finally, the extraction. The command will differ based on the archive's format:

  • ZIP: unzip archive.zip

  • TAR: tar -xvf archive.tar

  • TAR.GZ: tar -zxvf archive.tar.gz

Where instead of "archive" write the name of your archive's file. Extraction takes some time; as soon as it's finished, you will see this from the new line:

-bash-4.2$

and have an opportunity to run the new command:

You can open File Manager to double-check that your archive is already extracted and files waiting for you in a separate folder, named by the archive.

Did this answer your question?