LinuxQuestions.org
Help answer threads with 0 replies.
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-19-2011, 04:07 AM   #1
gardenair
Member
 
Registered: Oct 2004
Location: LH
Posts: 610

Rep: Reputation: 31
scp command (Remote to Local )


I am using cent os 5. I successfully copy a file from to my local computer to remote computer

PHP Code:
# scp file1.txt 192.168.1.10:/home 
The issue is how can I copy a file from remote computer to local machine ?

I have google but still fail to fetch file i.e remote to PC...> To ....> Local PC

thanks in advance,
garden
 
Old 06-19-2011, 04:10 AM   #2
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387
Hi,

Code:
scp 192.168.1.10:/home/file1.txt file1.txt
Hope this helps.
 
Old 06-19-2011, 05:35 AM   #3
gardenair
Member
 
Registered: Oct 2004
Location: LH
Posts: 610

Original Poster
Rep: Reputation: 31
thanks for the reply. Sorry I for get to write the IP settings. The IP Settings are

Local PC:- 192.168.1.10

Remote PC:- 192.168.1.20

Thnaks,
garden
 
0 members found this post helpful.
Old 06-19-2011, 05:47 AM   #4
siranjeevi
Member
 
Registered: May 2010
Location: India
Posts: 79

Rep: Reputation: 7
Hi,

Try the following command

Quote:
scp user@192.168.1.20:/home/file1.txt file1.txt
Hope this helps
 
0 members found this post helpful.
Old 06-19-2011, 11:05 AM   #5
ssrameez
Member
 
Registered: Oct 2006
Location: bangalore
Distribution: Fedora, Ubuntu, Debian, Redhat
Posts: 82

Rep: Reputation: 6
Hello gardenair

Practise checking the man pages..

"man scp" will give more details about usage.
 
0 members found this post helpful.
Old 06-20-2011, 01:20 AM   #6
gardenair
Member
 
Registered: Oct 2004
Location: LH
Posts: 610

Original Poster
Rep: Reputation: 31
thanks all for the reply. Well I have tried the following code.

PHP Code:
[root@localhost root]#scp 192.168.1.20:/home file1.txt
root@192.168.1.20's password:
scp: /home not a regular file
[root@localhost root] 
Description:. I want to copy a file i.e file1.txt from remote computer i.e 192.168.1.20 to my local computer home directory.
I have also checked 1st the man page but there was still confusion.

kindly guide me .
thanks
garden
 
Old 06-20-2011, 01:45 AM   #7
markush
Senior Member
 
Registered: Apr 2007
Location: Germany
Distribution: Slackware
Posts: 3,979

Rep: Reputation: 850Reputation: 850Reputation: 850Reputation: 850Reputation: 850Reputation: 850Reputation: 850
try
Code:
scp 192.168.1.20:/home/file1.txt .
the scp command works exactly like the cp command.
Probably you mean file1.txt in a users homedirectory, if the users name is gardenair, you may write
Code:
scp 192.168.1.20:/home/gardenair/file1.txt .
if you do it as root you will be asked for root's password, if you do it as the user you'll have to enter the user's password.

Markus
 
Old 06-20-2011, 02:09 AM   #8
networking.dept
Member
 
Registered: Dec 2010
Location: Ahmedabad
Distribution: Red Hat Enterprise Linux and Fedora
Posts: 44

Rep: Reputation: 8
@gardenair,

First execute pwd command to know where are you right now,

If your pwd is /home/gardenair then execute scp scp 192.168.1.20:/home/gardenair/file1.txt . as markush explained.

If you are into some other directory then execute scp 192.168.1.20:/home/gardenair/file1.txt /home/gardenair/

This error "scp: /home not a regular file" is because you are trying to copy directory, If you want to copy directory through scp then you have to provide option -r

Hope this helps you.

Last edited by networking.dept; 06-20-2011 at 02:09 AM. Reason: Spell mistake
 
Old 07-19-2011, 02:07 PM   #9
BradMarks
LQ Newbie
 
Registered: Jul 2011
Location: Los Angeles, CA
Distribution: rhel6
Posts: 26

Rep: Reputation: Disabled
I'm trying to do the same thing that gardenair is/was (sad when we never find out if our suggestions help or not). I say:
scp root@139.64.100.1: /usr3/d/HRF

I want to move the file HRF from /usr3/d/ on the server whose IP is 139.64.100.1 to my current attch point on the local server. No matter what I try I keep getting the .: not a regular file error message.

Any help would be greatly appreciated and I'll let you know if it helps or not!

-Brad
 
Old 07-19-2011, 02:22 PM   #10
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387
Hi,
Quote:
Originally Posted by BradMarks View Post
I'm trying to do the same thing that gardenair is/was (sad when we never find out if our suggestions help or not). I say:
scp root@139.64.100.1: /usr3/d/HRF

I want to move the file HRF from /usr3/d/ on the server whose IP is 139.64.100.1 to my current attch point on the local server. No matter what I try I keep getting the .: not a regular file error message.
There's an extra space that should not be there and you need to set the destination:
Code:
scp root@139.64.100.1:/usr3/d/HRF HRF
You don't have to give the filename, you can also use a . (dot) to tell scp to copy the files to the directory you are standing in:
Code:
scp root@139.64.100.1:/usr3/d/HRF .
BTW: It is not a good idea to do this as root user. If at all possible do this as a normal user.

Hope this helps.
 
1 members found this post helpful.
Old 07-19-2011, 02:30 PM   #11
BradMarks
LQ Newbie
 
Registered: Jul 2011
Location: Los Angeles, CA
Distribution: rhel6
Posts: 26

Rep: Reputation: Disabled
Drunna,
Thank you so much. That did the trick!
-Brad
 
Old 07-19-2011, 02:42 PM   #12
Reuti
Senior Member
 
Registered: Dec 2004
Location: Marburg, Germany
Distribution: openSUSE 13.1
Posts: 1,326

Rep: Reputation: 253Reputation: 253Reputation: 253
NB: If you do this often and donít want to write the TCP/IP address all the time, you can create a file ~/.ssh/config which will also bo honored by scp and put therein:
Code:
Host local
    Hostname  192.168.1.10

Host remote
    Hostname  192.168.1.20

Host foobar
    User      root
    Hostname  139.64.100.1
and use then:
Code:
scp foobar:/usr3/d/HRF .
 
1 members found this post helpful.
Old 07-19-2011, 02:58 PM   #13
BradMarks
LQ Newbie
 
Registered: Jul 2011
Location: Los Angeles, CA
Distribution: rhel6
Posts: 26

Rep: Reputation: Disabled
Thanks, Reuti. That makes for a few fewer keystrokes!

Thanks to all for your help. I'm sure I'LL BE BACK!
 
Old 07-19-2011, 07:09 PM   #14
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.8, Centos 5.10
Posts: 17,240

Rep: Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324
In general, its
Code:
scp <user>@<machine>:/path/to/file <user>@<machine>:/path/to/file
user is optional if same at both ends, else specify user for remote, not for local; specify machine for remote system only; must specify path for remote, specify path or '.' for local target.

HTH
 
Old 07-19-2011, 07:13 PM   #15
Reuti
Senior Member
 
Registered: Dec 2004
Location: Marburg, Germany
Distribution: openSUSE 13.1
Posts: 1,326

Rep: Reputation: 253Reputation: 253Reputation: 253
Quote:
Originally Posted by chrism01 View Post
; must specify path for remote, specify path or '.' for local target.
NB: here itís worth to add, that the path could be relative and if not specified on the remote side itís the home directory of the user and the relative path specification can start there.
 
  


Reply


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
Why can't I 'scp' from remote to local host? Nukeman Linux - Newbie 3 05-31-2011 12:22 PM
SCP issues over SSH... can't seem to copy from remote to local. ncn8ochaser Linux - Newbie 3 11-18-2010 01:17 AM
Does the command "telnet" works when remote and local are different operating system? Marty21 Linux - Networking 2 02-15-2009 09:12 PM
SCP from remote to local?? abovenbeyond Linux - Newbie 1 06-04-2008 05:45 PM
scp: copy a file from local machine to remote machine seran Linux - Newbie 8 10-30-2007 01:23 PM


All times are GMT -5. The time now is 12:58 PM.

Main Menu
Advertisement
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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration