LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (http://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Copying files from host onto my computer using ssh (http://www.linuxquestions.org/questions/linux-newbie-8/copying-files-from-host-onto-my-computer-using-ssh-949096/)

Adwat 06-07-2012 05:09 PM

Copying files from host onto my computer using ssh
 
Hi,
I have ssh'ed into a remote computer. I want to transfer a file from that computer onto my computer. I know how to do exactly the opposite (using scp)
What would be the syntax for doing this?

Any help would be greatly appreciated
Thanks!

Best,
Adwait

acid_kewpie 06-07-2012 05:19 PM

the opposite as in copy from your computer to the remote one? Just change the options around on the scp command line like you would do for any other file copy command:

scp file.txt user@server:file.txt

Adwat 06-07-2012 05:26 PM

Hi Chris,
Thanks for the reply!

So in this case,
file.txt is the file on the server that I want to copy?

There are two file.txt what should each one of them be?
Thanks!


Quote:

Originally Posted by acid_kewpie (Post 4698222)
the opposite as in copy from your computer to the remote one? Just change the options around on the scp command line like you would do for any other file copy command:

scp file.txt user@server:file.txt


will.cox 06-07-2012 10:45 PM

Quote:

Originally Posted by Adwat (Post 4698217)
Hi,
I have ssh'ed into a remote computer. I want to transfer a file from that computer onto my computer. I know how to do exactly the opposite (using scp)
What would be the syntax for doing this?

Any help would be greatly appreciated
Thanks!

Best,
Adwait

If you know the exact location of the file, maybe its easier using rsync instead. You dont have to logged into remote server.
Code:

rsync -avH -e ssh --progress localfilename user@remoteserver:/fullpath_on_remote

eg : rsync -avH -e ssh --progress /home/user/*.txt root@192.168.1.1:/var/www/html
  : upload local file to server

or

rsync -avH -e ssh --progress user@remoteserver:/fullpath_on_remote localpath

eg : rsync -avH -e ssh --progress admin@192.168.1.1:/var/www/html/*.html /home/geek/
  : download *.html files from server to local path /home/geek/


acid_kewpie 06-08-2012 01:48 AM

why would you use rsync just for that? Quite some overkill no?

will.cox 06-08-2012 02:41 AM

Quote:

Originally Posted by acid_kewpie (Post 4698462)
why would you use rsync just for that? Quite some overkill no?

I never used scp before. But I'd just give it a try and it looks like rsync too.
Frankly speak I have no idea about the differences between them, or maybe its security issue ?

acid_kewpie 06-08-2012 02:43 AM

no, it's not like rsync. it's like cp, but with a bit of remote connectivity thrown in too.


All times are GMT -5. The time now is 03:10 AM.