![]() SSH commands give you ultimate control over your cloud server. The above will archive the entire folder foldername in an archive named in the current working directory. An example of creating such a file is: tar -zcf foldername/ The most commonly used however is the tar.gz format. rarĮach archive type has its own mechanism to create a new archive file. To extract a Rar file, you can use: rar x archive. To extract a Tar.Gz file, you can use: tar -zxvf archive. To extract a Tar file, you can use: tar -xvf archive. ![]() To extract a ZIP file, you can use: unzip archive. We are finally logged in to our server via SSH Terminal and we now have a simple PHP “ Application”. Do not worry, just press the Enter button after pasting the password.Īfter successfully logging in, you’ll see a screen like in the image below. You will NOT see the password written in plain text, this is the default behaviour of the terminal. Go back to the server details, copy “ Password” and paste it on the terminal with the same procedure defined above. Go back to the server details, copy “ Username” and paste on the terminal after clicking right button, then select “ Paste from browser”. Once you click on the Launch SSH Terminal button, you may see a warning from Chrome. Once you get into the particular server, you’ll see the server credentials there. Login to your Cloudways account and go to the Servers tab. Conclusion – How To Extract Or Make Archives Via SSH 2023Ĭloudways is a managed cloud hosting platform that makes it easy for you to deploy, manage and monitor your applications on the cloud.Here are some Linux SSH Commands for Files and Directories.How To Extract Or Make Archives Via SSH.Same principle except before the final pipe of tar xf -, we’re squeezing gunzip -c in between to g-unzip the file first before untarring it. In case you have a tar.gz file or a tgz file, use:Ĭurl -u awesomeuser: -key /home/awesomeuser/.ssh/id_rsa -pubkey /home/awesomeuser/.ssh/id_rsa.pub scp://awesomeserver/tmp/ | gunzip -c - | tar xf. Because curl command will output whatever it gets to standard out stream ( STDOUT), we’re leveraging this capability by redirecting STDOUT to a pipe which is then fed into the tar command (as indicated by | tar xf -). We’re then asking the curl command to use the scp protocol for accessing our server (as indicated by scp://awesomeserver) and are then giving it the location of the tar file that we want to download (as indicated by /tmp/mytarfile.tar). For authentication, we are using our private and public keys as indicated by -key /home/awesomeuser/.ssh/id_rsa and -pubkey /home/awesomeuser/.ssh/id_rsa.pub flags. We’re using the curl command to download the file using awesomeuser as the username (indicated by -u awesomeuser). While this is “functional”, here’s an awesome way to do it:Ĭurl -u awesomeuser: -key /home/awesomeuser/.ssh/id_rsa -pubkey /home/awesomeuser/.ssh/id_rsa.pub scp://awesomeserver/tmp/mytarfile.tar | tar xf. 2) You extract the downloaded tar file(s). The problem with this is that its a two step action. So, if you had one or more tar files on a server and wanted to get them all down and then extract them somewhere to do your work, the normal way to achieve that would be: I’d found this command a while ago now but had completely forgotten about it until I stumbled upon it yesterday.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |