# Simple way to transfer files between two machines?

## xiaweitang

This could be very basic, but I have never done it before. I have a desktop running ubuntu, and a laptop running Gentoo. I want to occasionally transfer files between these two machines, and don't need fancy features. Maybe scp will simply work? But I don't have a domain name!

```
tux ~ # domainname

(none)
```

----------

## NathanZachary

It simply depends on what type of method you want to use.  If you are wanting to transfer over the network, there are many options.  If you only want to transfer files occasionally, and not very many or large files, you may just want to use a flash drive.  Please provide a little more information on the specifics of your goals, and we'll work from there.  :Smile: 

----------

## toralf

 *xiaweitang wrote:*   

> Maybe scp will simply work? 

 Try it :

```
touch x; scp x <user>@<remote_host>/tmp
```

?Last edited by toralf on Fri Mar 05, 2010 7:34 pm; edited 1 time in total

----------

## xiaweitang

I want to copy all my personal files in my desktop to my laptop so that I can do a clean install on the desktop. I can use usb, but I don't have it around now.

----------

## Jaglover

I'd export a directory on Ubuntu desktop over NFS.

For rare transfers I'd use SCP.

----------

## xiaweitang

 *toralf wrote:*   

>  *xiaweitang wrote:*   Maybe scp will simply work?  Try it :
> 
> ```
> touch x; scp x <user>@<remote_host>/tmp
> ```
> ...

 

What should be remote_host?

----------

## papahuhn

The IP.

----------

## Raistlin Majere

 *Quote:*   

> What should be remote_host?

 

The ip address of the computer you want to connect to 

On a side note , i use rsync to transfer between my laptop and desktop but that's just a matter of personal taste.

----------

## NeddySeagoon

xiaweitang,

The IP address of the remote system or its hostname if the name will resolve to an IP adddress.

You only need to specify <user>@  if you don't have the same username on both manchies.

The remote host will need to be running sshd.

Read 

```
man scp
```

```
scp <somefile> <remote_host>:/path/to/destination
```

is the simplest form of the command.

You can also use scp to transfer entire directores but its slow as the link is renegiotiated for every file.

sshfs will work if the ssh family of commands works too. That allows you to mount a directory from the remote system in your local filesystem tree without messing about with NFS.

----------

## xiaweitang

 *NeddySeagoon wrote:*   

> xiaweitang,
> 
> The IP address of the remote system or its hostname if the name will resolve to an IP adddress.
> 
> You only need to specify <user>@  if you don't have the same username on both manchies.
> ...

 

But there are so many users connected to the Internet, there maybe a lot of users using the same host name. If I don't specify IP, how does scp know which one to connect? 

Another question, won't my IP address changes each time I connect because I'm using DHCP?

----------

## NeddySeagoon

xiaweitang,

Do you want to transfer files between machines over the internet or just on your local network?

As you use DHCP, your DHCP server should resolve host names to their current IP addresses, so it should just work.

There is no danger of picking some random machine on the neat as you will be using a non-routable subnet, probably beginning 192.168. but there are others. 

Packets destined for these non routeable subnets are dropped on sight by routers on the internet.

You can run ifconfig on the remote host to see what its IP address is. Its unlikely to change while its powered up as it will renew its lease on the IP address from time to time. As there is no pressure on IP addresses on your network, its address will be static. It may change from power up to power up.

----------

## Raistlin Majere

 *Quote:*   

> Another question, won't my IP address changes each time I connect because I'm using DHCP?

 

Most likely yes , drove me nuts everytime i was away and tried to connect to my home computer until i just set a static ip address for it. I used this wiki to help me 

http://www.gentoo-wiki.info/HOWTO_static_ip_with_dhcp_router

----------

## xiaweitang

I'm transfering through internet. Using scp and the ip address found by ifconfig did the job. Thanks to all.

----------

