Posted: . At: 12:07 PM. This was 2 years ago. Post ID: 16390
Page permalink. WordPress uses cookies, or tiny pieces of information stored on your computer, to verify who you are. There are cookies for logged in users and for commenters.
These cookies expire two weeks after they are set.


How to use SSH to copy remote files from a server to your local machine.


This simple one-liner will copy all files into a tarball, send the compressed files over a secure SSH connection and then uncompress the files into a local directory.

┌──(john㉿DESKTOP-PF01IEE)-[~/website]
└─$ ssh bejiitas@192.168.220.115 -p 2222 "cd arma3/ ; tar cBf - ." | tar xvBf -
bejiitas@192.168.220.115's password: 
./
./README
./example_urllist.txt
./example_config.xml
./sitemap_gen.pl

This parameter to SSH will do this.

"cd arma3/ ; tar cBf - ." | tar xvBf -

A very useful tip to quickly copy files over SSH if you do not wish to use rsync. And it is fast as well. Just have your SSH password ready when prompted, this is a good tip for a regular SSH user.

Here is another version. This will save just the tar file containing the files I wish to download.

┌──(john㉿DESKTOP-PF01IEE)-[~/website]
└─$ ssh bejiitas@192.168.220.115 -p 2222 "cd ssl/ ; tar cBf - ." > me.tar
bejiitas@192.168.220.115's password:

This is all very useful. This tars up the whole folder in one go and then transfers the file to your local machine over SSH. This should save a lot of time and is more secure than FTP.


Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.