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
-
workstationandservera
-
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}.txtUpload the file to
servera, connect to the server, and confirm that the file arrived.scp {YOUR_NAME}.txt student@servera:~ ssh student@servera ls -lAdd the last game, book, or movie you finished to the file, then return to the VDI.
vim {YOUR_NAME}.txt exitDownload the edited file into the current directory and verify that it returned.
scp student@servera:~/{YOUR_NAME}.txt . Get-ChildItem -
Upload several files using globbing
Connect to
workstation, create three files, and list them.ssh student@workstation touch notes.txt report.txt photo.png lsPreview what Bash passes to
scp, upload the matching files, and list the files onservera.echo scp *.txt student@servera:~ scp *.txt student@servera:~ ssh student@servera ls -
Download several files using globbing
Create a destination directory on
workstationand move into it.mkdir -p ~/from-servera cd ~/from-serveraKeep the remote pattern intact with single quotes, download the matching files, and verify the result.
scp 'student@servera:*.txt' . ls -lClean 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