Exercise

Copying Files with scp Exercise

Task

Copy a file to servera and back again, then upload and download several files using globbing.

Student hosts
Windows VDI session and servera
Demonstration hosts
workstation and servera
  1. Send and receive a file between VDI and servera

    Open Windows Terminal on the VDI and create a file named after yourself. Write your favorite text editor into the file and save it.

    notepad {YOUR_NAME}.txt

    Upload the file to servera, connect to the server, and confirm that the file arrived.

    scp {YOUR_NAME}.txt student@servera:~
    ssh student@servera
    ls -l

    Add the last game, book, or movie you finished to the file, then return to the VDI.

    vim {YOUR_NAME}.txt
    exit

    Download the edited file into the current directory and verify that it returned.

    scp student@servera:~/{YOUR_NAME}.txt .
    Get-ChildItem
  2. Upload several files using globbing

    Connect to workstation, create three files, and list them.

    ssh student@workstation
    touch notes.txt report.txt photo.png
    ls

    Preview what Bash passes to scp, upload the matching files, and list the files on servera.

    echo scp *.txt student@servera:~
    scp *.txt student@servera:~
    ssh student@servera ls
  3. Download several files using globbing

    Create a destination directory on workstation and move into it.

    mkdir -p ~/from-servera
    cd ~/from-servera

    Keep the remote pattern intact with single quotes, download the matching files, and verify the result.

    scp 'student@servera:*.txt' .
    ls -l

    Clean up

    Return to your home directory and remove the exercise files from both Linux hosts.

    cd ~
    rm notes.txt report.txt photo.png
    rm -rf ~/from-servera
    ssh student@servera rm notes.txt report.txt