Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

The command I am using to copy a file from remote to my local machine is as follows:

scp root@IP_OF_MY_REMOTE_MACHINE:/home/sqldump.sql ~

So I am copying from /home directory of remote machine to my local machine home directory but what i get is a file copied in the remote machine's home directory.

Where I am going wrong ?

I know it must be silly mistake. But any help will be thankfully received.

share|improve this question
Not sure about this but try ~/ instead of ~. – terdon Feb 15 '13 at 12:08
No terdon still not finished but atleast this problem is removed where a file by my local username was created and that sqldump.sql was copied into that. – John Doe Feb 15 '13 at 12:13
What's the full path of your home directory? Does it contain any non-alphanumeric characters? – Dennis Feb 15 '13 at 12:14
full path of my home directory is /home/babloo. It does n't have any non-alphanumeric charatcers. – John Doe Feb 15 '13 at 12:15
Does this happen as well if you use the full path, i.e., /home/babloo instead of ~? – Dennis Feb 15 '13 at 12:19

You need to include the file name in target, like this:

scp root@IP_OF_MY_REMOTE_MACHINE:/home/sqldump.sql ~/sqldump.sql

share|improve this answer
It didn't work Pete Cornell. Thanks though. – John Doe Feb 16 '13 at 4:58
Ssh into the remote system and verify the file path. The one you have, /home/sqldump.sql looks unusual. It's more likely to be in your home directory, /home/[username]/sqldump.sql. You could also try rsync in the same manner, and verify that root is permitted ssh access. – Pete Cornell Feb 16 '13 at 18:33
up vote 0 down vote accepted

Sorry to all. Human Stupidity is unbounded, I am a living example of that. I typed command correctly, but it was not in the machine where it should have been typed.

The above command should be typed at the local machine terminal and then it would fetch the copy of the required file from remote machine to the local machine. So the command makes sense only if typed at the local machine terminal:-

scp root@IP_OF_MY_REMOTE_MACHINE:/home/sqldump.sql ~/

and then it would copy from the server machine to the local machine. Once again sorry to all esteemed members, especially terdon, Hennes,Dennis and Pete Cornell.But thanks all for help.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .