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!
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.
Launching SSH Terminal
Once you get into the particular server, you’ll see the server credentials there. Click on “Launch 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
- Where Am I?
- List all files and folders
- Change Directory
- Create a Folder
- Create a File
- Rename File
- Rename Folder
- Copy File
- Remove File
- Move File
- Move Multiple Files at Once
- Edit a File
- Run a File
- Remove Folder
- File Permissions
- Folder Permissions
Where Am I?
SSH Command: pwd
pwd: This will display the folder you’re currently in.
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
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
We’re in the applications folder now.
Below are the steps to get into an 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.
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
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
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.
BatchFolder has now successfully been renamed to Bat.
Copy File
SSH Command: cp renamedfile.php NewFolder-1
cp – Used to 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.
The file is now removed successfully.
Move File
SSH Command: mv renamedfile.php NewFolder-1
mv – Used to 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
You can see, we’ve successfully moved two files from public_html to BatchFolder.
Edit a File
SSH Command: vi renamedfile.php
It will open up the file to write some text.
On your keyboard, press the “INSERT” key and start writing.
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.
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.
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.
Folder Permissions
Navigate to the directory, you want to set permissions.
SSH Command: chmod -R [PERMISSIONS]
For more details about File Manager related commands. You can refer to “Linux Commands” page.
Quick Links
- Pressable Coupon Codes, Promo Codes
- HostGator Vs Wp Engine
- Bright Data (formerly) Luminati.io Review
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!