[Beaglebone Black] File Transfer with PC using SCP

On Windows, we can easily transfer files between the PC and the BBB through SecureShell File Transfer Client. However, in Linux, we will have to use the terminal program Secure Copy or SCP that’s built-in.

Overall, the scp command for copying to a computer (aka use the to computer’s username and ip) is:

 scp filename usename@ipaddress:/directory/ 

First we need to find the IP Address of the BBB and the PC, use the following command:

 ifconfig 

This is the output from the BBB:

eth0      Link encap:Ethernet  HWaddr 1c:ba:8c:98:ef:4f  
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
          Interrupt:40 

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

usb0      Link encap:Ethernet  HWaddr c6:ca:a6:85:cf:9e  
          inet addr:192.168.7.2  Bcast:192.168.7.3  Mask:255.255.255.252
          inet6 addr: fe80::c4ca:a6ff:fe85:cf9e/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:197352 errors:0 dropped:0 overruns:0 frame:0
          TX packets:359213 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:10460267 (9.9 MiB)  TX bytes:56807339 (54.1 MiB)

And this is the output from the PC:

eth0      Link encap:Ethernet  HWaddr ec:a8:6b:f1:ef:ea  
          inet addr:128.180.112.46  Bcast:128.180.115.255  Mask:255.255.252.0
          inet6 addr: fe80::eea8:6bff:fef1:efea/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:231823 errors:0 dropped:0 overruns:0 frame:0
          TX packets:40236 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:112426350 (112.4 MB)  TX bytes:8012706 (8.0 MB)
          Interrupt:20 Memory:f7c00000-f7c20000 

eth3      Link encap:Ethernet  HWaddr 1c:ba:8c:98:ef:51  
          inet addr:192.168.7.1  Bcast:192.168.7.3  Mask:255.255.255.252
          inet6 addr: fe80::1eba:8cff:fe98:ef51/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:359261 errors:0 dropped:0 overruns:0 frame:0
          TX packets:197409 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:35978849 (35.9 MB)  TX bytes:21914639 (21.9 MB)

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:3269 errors:0 dropped:0 overruns:0 frame:0
          TX packets:3269 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:429869 (429.8 KB)  TX bytes:429869 (429.8 KB)

We know that the BBB is connected to the computer by a USB, so look under ubs0, the IP Address is 192.168.7.2 . In addition, the BBB’s user is debian (you can see that in the terminal, the header before you type in the command, the username is before the @ symbol. The string after is the computer name), so we got debian@192.168.7.2 .

On the PC’s side, look for the address that start the same as the BBB, we got 192.168.7.1, that’s the PC’s IP Address. The PC’s username is space, so we got space@192.168.7.1 .

Example

I got a file LEDServer.py on the BBB’s home folder that I want to send to my PC’s home folder. I change directory to that file in the BBB and type in the following (using the BBB’s terminal):

scp LEDServer.py space@192.168.7.1:/home/space/

So now, let say I want to copy from PC to BBB, I just replace the username and IP with the BBB’s info and run the same command on the PC’s side.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s