# how to copy files across SSH HELP!!

## zenon

I can log into SSH fine, its awesome.... however there is a file called cond1d.exe in my home directory on the remote computer that I want to thransfer to my local computer....HOW CAN I DO THAT??!

I think it has something to do with scp, but I can't get anything to anything.

thnx

----------

## rasmussen

scp username@remotehost:cond1d.exe .

----------

## WhyteWolf

two ways really

scp <user>@host:file filename

or sftp

----------

## zenon

k, I tried these 2 commands

```
<me@kantares:196>$ scp me@kantares:cond1d.exe .

me@kantares's password:

cond1d.exe           100% |*****************************|   416 KB    00:00

<me@kantares:197>$ scp me@kantares:cond1d.exe ~/

me@kantares's password:

cond1d.exe           100% |*****************************|   416 KB    00:00
```

where are the files?Last edited by zenon on Sat Oct 09, 2004 11:32 pm; edited 1 time in total

----------

## Fillepe The Mexican

The should be in either your home directory or the current working directory.

----------

## zenon

all that its doing is copying into the remote directory, I want it to copy to my local directory.  :Sad: 

----------

## nilson

No, no no.

You use scp with the username and host of the remote machine.

----------

## pjp

Moved from Gentoo Chat.

----------

## WhyteWolf

 *zenon wrote:*   

> all that its doing is copying into the remote directory, I want it to copy to my local directory. 

 

then try this 

scp remoteusername@remotehost:remotefile localusername@localhost:localfilename

----------

## zenon

when I do that it gives me the error:

```
sh: /us: not found
```

----------

## Andersson

 *zenon wrote:*   

> when I do that it gives me the error:
> 
> ```
> sh: /us: not found
> ```
> ...

 

If you have spaces or weird characters in the path, put quotes around it.

----------

## zenon

this is exactly what I typed in:

```
<me@kantares:260>$ scp me@kantares:cond1d.exe me@zen:./cond1d.exe

sh: /us: not found

<me@kantares:261>$ scp me@kantares:cond1d.exe me@zen:cond1d.exe

sh: /us: not found
```

  :Sad: 

----------

## Andersson

Ok then, try with the full path. Something like scp user@computer:/home/user/file /home/something/file

Or, use the sftp instead if you're tired of scp. Just sftp user@computer, then you can use cd and ls like normal, and the command get to download the file. I don't like sftp myself, there's no tab completion!  :Smile: 

----------

## Mben

both gnome and kde can use sftp

in konquer put 

sftp://user@host in the address bar

gnome will do it too. i can look up how if you need later

edit:

in gnome you can do it from the network servers button under applications. 

file -> connect to server then enter a name to show up on your desktop and the url as aboveLast edited by Mben on Sun Oct 10, 2004 12:49 pm; edited 1 time in total

----------

## OdinsDream

I'm not sure if this point was made...

when you do: scp remoteusername@remotehost:<file> <local path>

... you should be running that command not from the remote machine, but from the local machine. The <file> part of the command starts off at your home directory (on the remote computer) and the <local path> part starts off at the directory you're currently in (on the local computer).

Here's a clearer example. I am on my home computer, I am in /home/odinsdream/ ... and I'm going to copy a file from my web host over to my current home directory. The file on my web host is at: /home/odinsdream/public_html/kiss.jpg

So, here we go:

scp odinsdream@mywebsite.com:~/public_html/kiss.jpg .

The final dot copies kiss.jpg into my current directory. If I wanted to copy it into the local directory called "images", then I'd do:

scp odinsdream@mywebsite.com:~/public_html/kiss.jpg images/

Good luck! If you have trouble, please ask more questions.

----------

