0
0
Linux CLIscripting~10 mins

scp and rsync for file transfer in Linux CLI - Step-by-Step Execution

Choose your learning style9 modes available
Concept Flow - scp and rsync for file transfer
Start: Choose tool
scp or rsync?
scpRun scp command
Copy file(s)
End: Transfer done
Run rsync command
Compare source & dest
Copy only changes
End: Transfer done
Choose between scp or rsync, run the command, and transfer files; scp copies all files, rsync copies only changes.
Execution Sample
Linux CLI
scp file.txt user@remote:/path/
rsync -avz file.txt user@remote:/path/
Copy file.txt to remote server using scp and rsync commands.
Execution Table
StepCommandActionOutputNotes
1scp file.txt user@remote:/path/Start scp transferConnecting to remote host...scp initiates SSH connection
2scp file.txt user@remote:/path/Copy file.txtfile.txt 100% transferredscp copies entire file
3scp file.txt user@remote:/path/End transferTransfer completescp finishes after full copy
4rsync -avz file.txt user@remote:/path/Start rsync transferConnecting to remote host...rsync initiates SSH connection
5rsync -avz file.txt user@remote:/path/Check differencesfile.txt differs, syncingrsync compares source and destination
6rsync -avz file.txt user@remote:/path/Copy changed partsfile.txt 100% transferredrsync copies only changes
7rsync -avz file.txt user@remote:/path/End transferTransfer completersync finishes after syncing changes
8rsync -avz file.txt user@remote:/path/Check differencesfile.txt identical, no transferIf no changes, rsync skips copying
9EndNo more actionsTransfer doneProcess ends
💡 Transfer ends after copying files fully (scp) or syncing changes (rsync)
Variable Tracker
VariableStartAfter scpAfter rsync startAfter rsync checkAfter rsync copyFinal
ConnectionNoneEstablishedEstablishedEstablishedEstablishedClosed
File Statusfile.txt localfile.txt copiedfile.txt localfile.txt differs or identicalfile.txt synced or skippedfile.txt remote
Transfer Progress0%100%0%Checked100% or 0%Complete
Key Moments - 3 Insights
Why does rsync sometimes transfer less data than scp?
Because rsync compares source and destination files first and only copies changed parts, as shown in execution_table rows 5 and 6.
What happens if the file is already identical on the remote side when using rsync?
rsync detects no changes and skips copying, as shown in execution_table row 8, saving time and bandwidth.
Does scp check for differences before copying files?
No, scp copies the entire file every time without checking, as shown in execution_table rows 1-3.
Visual Quiz - 3 Questions
Test your understanding
Look at the execution_table, at which step does rsync decide if it needs to copy the file?
AStep 2
BStep 7
CStep 5
DStep 3
💡 Hint
Check the 'Action' column for rsync steps where it checks differences.
According to variable_tracker, what is the 'Transfer Progress' after scp finishes?
A50%
B100%
C0%
DChecked
💡 Hint
Look at the 'After scp' column for 'Transfer Progress'.
If the file is identical on remote, what output does rsync show according to execution_table?
Afile.txt identical, no transfer
Bfile.txt differs, syncing
Cfile.txt 100% transferred
DTransfer failed
💡 Hint
See execution_table row 8 for rsync behavior when files match.
Concept Snapshot
scp copies files fully over SSH every time.
rsync compares source and destination, copying only changes.
Use scp for simple full copies.
Use rsync to save time and bandwidth.
Both require SSH access.
rsync has options like -a (archive), -v (verbose), -z (compress).
Full Transcript
This visual execution shows how scp and rsync transfer files. First, you choose the tool. scp connects to the remote host and copies the entire file, then finishes. rsync connects, checks if the file differs, and copies only changed parts if needed, or skips copying if files are identical. Variables like connection status, file status, and transfer progress update step-by-step. Key points: rsync saves bandwidth by syncing changes; scp always copies full files. The quizzes test understanding of when rsync copies and how progress is tracked.