LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 06-07-2012, 05:09 PM   #1
Adwat
LQ Newbie
 
Registered: May 2012
Posts: 14

Rep: Reputation: Disabled
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
 
Old 06-07-2012, 05:19 PM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,386

Rep: Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963
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
 
Old 06-07-2012, 05:26 PM   #3
Adwat
LQ Newbie
 
Registered: May 2012
Posts: 14

Original Poster
Rep: Reputation: Disabled
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 View Post
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
 
Old 06-07-2012, 10:45 PM   #4
will.cox
LQ Newbie
 
Registered: Jun 2012
Posts: 7

Rep: Reputation: Disabled
Quote:
Originally Posted by Adwat View Post
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/
 
Old 06-08-2012, 01:48 AM   #5
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,386

Rep: Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963
why would you use rsync just for that? Quite some overkill no?
 
Old 06-08-2012, 02:41 AM   #6
will.cox
LQ Newbie
 
Registered: Jun 2012
Posts: 7

Rep: Reputation: Disabled
Quote:
Originally Posted by acid_kewpie View Post
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 ?
 
Old 06-08-2012, 02:43 AM   #7
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,386

Rep: Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963
no, it's not like rsync. it's like cp, but with a bit of remote connectivity thrown in too.
 
1 members found this post helpful.
  


Reply

Tags
scp, ssh


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
COmputer crashes when copying files ApAdrian Linux - Networking 1 06-25-2007 09:30 AM
Copying files from Host (Ubuntu) to Guest (XP) OS with VMWare lebabyg Linux - Software 5 04-10-2007 11:57 AM
Copying Large File via SSH/SFTP over WiFi link Always Stalls and Freezes Host Haz2a Linux - Wireless Networking 1 03-16-2007 03:35 PM
Copying files to local computer whilst in ssh tunnel Maverick1182 Linux - Newbie 4 10-07-2006 01:29 PM
copying files from another computer(win) lin00b Linux - Newbie 5 07-27-2004 03:53 AM


All times are GMT -5. The time now is 11:31 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration