[email protected]

How To Extract Or Make Archives Via SSH 2024 : Step By Step Guide

Affiliate disclosure: In full transparency – some of the links on our website are affiliate links, if you use them to make a purchase we will earn a commission at no additional cost for you (none whatsoever!).

SSH is a secure protocol that allows you to access your files securely. This tool will allow you to extract or create archives quickly and easily, without having to worry about the security of your data.

Extracting or making archives can be a daunting task, but with How To Extract Or Make Archives Via SSH, it doesn’t have to be! With our simple step-by-step guide, you’ll be able to extract any archive in no time at all!

There are a few different ways to extract or create archives, but sometimes the easiest way is to use SSH. With SSH, you can quickly and easily extract or create archives without having to worry about file extensions or anything like that.

In just a few simple steps, you’ll be able to extract or create any type of archive you need. So why not give it a try? It’s the easiest way to get the job done!

How To Extract Or Make Archives Via SSH

Login to Your Hosting

Cloudways is a managed cloud hosting platform that makes it easy for you to deploy, manage and monitor your applications on the cloud.

Login to your Cloudways account and go to the Servers tab.

services

Launching SSH Terminal

Once you get into the particular server, you’ll see the server credentials there. Click on “Launch SSH Terminal”.

Launching SSH Terminal

Once you click on the Launch SSH Terminal button, you may see a warning from Chrome.

Accessing the SSH Terminal

Go back to the server details, copy “Username” and paste on the terminal after clicking right button, then select “Paste from browser”.

Go back to the server details, copy “Password” and paste it on the terminal with the same procedure defined above. You will NOT see the password written in plain text, this is the default behaviour of the terminal. Do not worry, just press the Enter button after pasting the password.

After successfully logging in, you’ll see a screen like in the image below.

We are finally logged in to our server via SSH Terminal and we now have a simple PHP “Application”.

How To Extract Or Make Archives Via SSH

To extract a ZIP file, you can use:

unzip archive.zip

To extract a Tar file, you can use:

tar -xvf archive.tar

To extract a Tar.Gz file, you can use:

tar -zxvf archive.tar.gz

To extract a Rar file, you can use:

rar x archive.rar

Each archive type has its own mechanism to create a new archive file. The most commonly used however is the tar.gz format. An example of creating such a file is:

tar -zcf archive-name.tar.gz foldername/

The above will archive the entire folder foldername in an archive named archive-name.tar.gz in the current working directory.

What Can We Do Using SSH Commands?

SSH commands give you ultimate control over your cloud server. With just a few simple keystrokes, you can manage files, install software, and configure settings. Whether you’re a beginner or an experienced administrator, SSH commands are the perfect tool for any task.

Here are some Linux SSH Commands for Files and Directories

  1. Where Am I?
  2. List all files and folders
  3. Change Directory
  4. Create a Folder
  5. Create a File
  6. Rename File
  7. Rename Folder
  8. Copy File
  9. Remove File
  10. Move File
  11. Move Multiple Files at Once
  12. Edit a File
  13. Run a File
  14. Remove Folder
  15. File Permissions
  16. Folder Permissions

Where Am I?

SSH Command: pwd

pwd: This will display the folder you’re currently in.

Folder

This is the root directory of the Cloudways platform.

List all Files and Folders

SSH Command: ls

Ls – Used to list all files and folders

Files and Folders

You can see all the files and folders that are present in the root directory.

Change Directory

SSH Command: cd applications

cd – Used to change the current directory

Directory

We’re in the applications folder now.

Below are the steps to get into an application.

PHP Application

cd applications – Get into Applications folder

ls – List all files in the applications folder

cd efaryzckmf – Get into efaryzckmf (our application) folder

ls – List all files in efaryzckmf folder

cd public_html – Get into the public_html folder

ls – List all files and folders in public_html folder

Create a Folder

Now we’re going to create a folder so that we can play around with it.

SSH Command: mkdir NewFolder-1

mkdir – Creates a new folder within public_html folder.

New Folder

You can see that the NewFolder-1 has been created successfully!

Create a File

SSH Command: touch newfile.php

touch – Used to create a new file

Create a new file

newfile.php is now successfully created in the public_html folder.

Rename File

SSH Command: mv newfile.php renamedfile.php

mv – Used to rename a file. It will rename newfile.php to renamedfile.php

Rename File

newfile.php has now successfully been renamed to renamedfile.php. Its syntax is mv OLDNAME NEWNAME.

Rename Folder

SSH Command: mv BatchFolder Bat

mv – Used to rename a folder too. It will rename BatchFolder to Bat.

2

BatchFolder has now successfully been renamed to Bat.

Copy File

SSH Command: cp renamedfile.php NewFolder-1

cp – Used to copy files.

Copy files

ls – List all files and folders in public_html

cd NewFolder-1 – Get into NewFolder-1

ls – List all files and folders in NewFolder-1

You can see, the file is copied successfully. Its syntax is cp SOURCE DESTINATION.

Remove File

SSH Command: rm renamedfile.php

rm – Used to remove a file.

Remove Files

The file is now removed successfully.

Move File

SSH Command: mv renamedfile.php NewFolder-1

mv – Used to move files.

Move Files

You can see that the file has moved successfully. Its syntax is mv SOURCE DESTINATION

cd .. – Used to go one step back

ls – List all files and folders in the public_html. Currently, you can see the file renamedfile.php there.

mv renamedfile.php NewFolder-1 – Moving file renamedfile.php to NewFolder-1

ls – List of all files and folders in the public_html. You can see, file is not there anymore, as it is moved.

cd NewFolder-1 – Get into NewFolder-1

ls – List all files in NewFolder-1. You can see the new file is there.

Move Multiple Files at Once

SSH Command: mv ht.html renamedfile.php ./BatchFolder

1

You can see, we’ve successfully moved two files from public_html to BatchFolder.

Edit a File

SSH Command: vi renamedfile.php

Edit File

It will open up the file to write some text.

On your keyboard, press the “INSERT” key and start writing.

Insert Key

Once you’re done, press “ESC” and you will exit from the editor. Then press “ SHIFT + : ” and it will direct you to type a command line at the bottom left.

Type anyone of the following.

q! – Exit without saving

x! – Save changes and Exit

Run a File

SSH Command: php renamedfile.php

php – It is used to run a PHP script.

Run a File

The file is running successfully.

Remove Folder

SSH Command: rm -r NewFolder-1

rm – It is used to remove files and folders. To remove a folder and its sub folders/files the -r is used. It represents the removal of all files and subfolders within a folder.

SSH on Cloud (10)

File Permissions

SSH Command: CHMOD 755 renamedfile.php

CHMOD – Used to control file permissions

P.S: If you are on Cloudways server, you might need to reset permissions so that the server admin can change the file permissions.

To reset, navigate to your application, from the left pane, go to Application Settings and click on Reset Permission. Before making any changes, read the File Permissions guideline first.

File Permission

Numerical Permissions

Folder Permissions

Navigate to the directory, you want to set permissions.

SSH Command: chmod -R [PERMISSIONS]

3

For more details about File Manager related commands. You can refer to “Linux Commands” page.

Quick Links 

Conclusion – How To Extract Or Make Archives Via SSH 2024

With our simple step-by-step guide, you’ll be able to extract any archive in no time at all! Whether it is a ZIP file or an RAR file, the process of extracting your files will become second nature with these SSH tips. If you are looking for extra help setting up this protocol on your computer.

The easiest way to manage your Linux servers and applications. Unlike other cloud providers, we’ve integrated an online file manager with our SSH commands, making it easy for you to get things done.

Whether you need to edit a file or manage your server, Conclusion is the perfect tool for the job. Try it today and see what you’ve been missing!

Diksha Garg

Hi, I'm Diksha! As a tech writer and SEO products reviewer, I have a deep passion for technology and a keen eye for quality SEO tools. I love exploring the latest tech trends and researching various SEO products to provide insightful and informative reviews. Through my writing, I aim to help businesses and individuals make informed decisions about the best tools and products to enhance their SEO strategies. Let me guide you through the ever-evolving world of technology and SEO! Connect with me on Linkedin

Leave a Comment