Moving files to the Raspberry Pi (Intermediate)

This task will describe how to:

  • Copy files from a flash drive to the SD card
  • Download files from a remote site
  • Use the local network to transfer files from a computer to the Raspberry Pi

Getting ready

You will need:

  • A Raspberry Pi
  • An SD card with the official Raspberry Pi OS, Raspbian, properly loaded
  • A USB keyboard
  • A USB mouse
  • A USB flash drive
  • A 5V 1A power supply with Micro-USB connector
  • A network connection
  • Optional: powered USB hub
  • And a screen hooked up to your Raspberry Pi

How to do it...

For downloading from a remote site, perform the following steps:

  1. Copy down the URL address of the file you want to download.
  2. From the command line, enter wget http://example.com/link/to/file/filename.
  3. The file will be downloaded to the current folder on your Raspberry Pi.

For copying from a flash drive, perform the following steps:

  1. From the command line enter startx to load GUI.
  2. Insert your USB flash drive into one of the available USB ports.
  3. Select Open in File Manager from the pop-up window and click on Ok.
  4. From the File Manager you can drag-and-drop files between the USB drive and SD card.

For copying using FileZilla and SCP/SFTP, perform the following steps:

  1. Download and install FileZilla.
    How to do it...
  2. With FileZilla open, go to the File menu and select Site Manager.
  3. Click on the New Site button, and enter in a name for the newly created item.
  4. In the Host text box, enter the IP address of your Raspberry Pi.
    1. The easiest way to find out your Raspberry Pi's IP is by watching Raspbian boot up. Above the login prompt will be a message displaying your current IP address.
    2. You can also find out the IP of your device by typing ifconfig at the command line and pressing Enter. Your IP will be displayed next to eth0.
  5. From the Protocol drop-down menu select SFTP - SSH File Transfer Protocol.
  6. From the Logon Type drop-down menu select Normal.
  7. Enter in your Raspberry Pi's username and password (default: pi / raspberry) and then click on the Connect button.
  8. After a moment, you will be connected to your Raspberry Pi and viewing the files in the Pi's user home directory, /home/pi.
  9. You can now create new folders and drag-and-drop files between your computer and the Raspberry Pi.

How it works...

wget is a powerful tool for downloading numerous items from the Internet or a local network. The simplest way of using it is by just giving it a URL, and wget will try to download the item to the same folder in which it is running.

The desktop environment provides a modern experience akin to using Windows or Mac OS X. When you insert a USB flash drive, the GUI recognizes a new device that has been inserted and automatically mounts and configures the drive for use. From this point onward, you can use the file manager to drag-and-drop files between the Raspberry Pi's storage and your flash drive.

FileZilla is a popular open source file transfer application. By default, Raspbian ships with SSH-enabled SCP and SFTP allows files to be transferred over the SSH protocol. FileZilla supports SCP and SFTP out of the box. When you connect to the Raspberry Pi using SFTP, you are using SSH and SCP for securely and efficiently moving files from one place to the other.

There's more...

A few useful reference links:

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.16.66.206